summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/PC
diff options
context:
space:
mode:
authorshadchin <[email protected]>2022-04-18 12:39:32 +0300
committershadchin <[email protected]>2022-04-18 12:39:32 +0300
commitd4be68e361f4258cf0848fc70018dfe37a2acc24 (patch)
tree153e294cd97ac8b5d7a989612704a0c1f58e8ad4 /contrib/tools/python3/src/PC
parent260c02f5ccf242d9d9b8a873afaf6588c00237d6 (diff)
IGNIETFERRO-1816 Update Python 3 from 3.9.12 to 3.10.4
ref:9f96be6d02ee8044fdd6f124b799b270c20ce641
Diffstat (limited to 'contrib/tools/python3/src/PC')
-rw-r--r--contrib/tools/python3/src/PC/clinic/_msi.c.h716
-rw-r--r--contrib/tools/python3/src/PC/clinic/msvcrtmodule.c.h70
-rw-r--r--contrib/tools/python3/src/PC/clinic/winreg.c.h315
-rw-r--r--contrib/tools/python3/src/PC/clinic/winsound.c.h22
-rw-r--r--contrib/tools/python3/src/PC/msvcrtmodule.c40
-rw-r--r--contrib/tools/python3/src/PC/pyconfig.h13
-rw-r--r--contrib/tools/python3/src/PC/winreg.c79
7 files changed, 1088 insertions, 167 deletions
diff --git a/contrib/tools/python3/src/PC/clinic/_msi.c.h b/contrib/tools/python3/src/PC/clinic/_msi.c.h
new file mode 100644
index 00000000000..85c4d226ee4
--- /dev/null
+++ b/contrib/tools/python3/src/PC/clinic/_msi.c.h
@@ -0,0 +1,716 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_msi_UuidCreate__doc__,
+"UuidCreate($module, /)\n"
+"--\n"
+"\n"
+"Return the string representation of a new unique identifier.");
+
+#define _MSI_UUIDCREATE_METHODDEF \
+ {"UuidCreate", (PyCFunction)_msi_UuidCreate, METH_NOARGS, _msi_UuidCreate__doc__},
+
+static PyObject *
+_msi_UuidCreate_impl(PyObject *module);
+
+static PyObject *
+_msi_UuidCreate(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_UuidCreate_impl(module);
+}
+
+PyDoc_STRVAR(_msi_FCICreate__doc__,
+"FCICreate($module, cabname, files, /)\n"
+"--\n"
+"\n"
+"Create a new CAB file.\n"
+"\n"
+" cabname\n"
+" the name of the CAB file\n"
+" files\n"
+" a list of tuples, each containing the name of the file on disk,\n"
+" and the name of the file inside the CAB file");
+
+#define _MSI_FCICREATE_METHODDEF \
+ {"FCICreate", (PyCFunction)(void(*)(void))_msi_FCICreate, METH_FASTCALL, _msi_FCICreate__doc__},
+
+static PyObject *
+_msi_FCICreate_impl(PyObject *module, const char *cabname, PyObject *files);
+
+static PyObject *
+_msi_FCICreate(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ const char *cabname;
+ PyObject *files;
+
+ if (!_PyArg_CheckPositional("FCICreate", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("FCICreate", "argument 1", "str", args[0]);
+ goto exit;
+ }
+ Py_ssize_t cabname_length;
+ cabname = PyUnicode_AsUTF8AndSize(args[0], &cabname_length);
+ if (cabname == NULL) {
+ goto exit;
+ }
+ if (strlen(cabname) != (size_t)cabname_length) {
+ PyErr_SetString(PyExc_ValueError, "embedded null character");
+ goto exit;
+ }
+ files = args[1];
+ return_value = _msi_FCICreate_impl(module, cabname, files);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_Database_Close__doc__,
+"Close($self, /)\n"
+"--\n"
+"\n"
+"Close the database object.");
+
+#define _MSI_DATABASE_CLOSE_METHODDEF \
+ {"Close", (PyCFunction)_msi_Database_Close, METH_NOARGS, _msi_Database_Close__doc__},
+
+static PyObject *
+_msi_Database_Close_impl(msiobj *self);
+
+static PyObject *
+_msi_Database_Close(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_Database_Close_impl(self);
+}
+
+PyDoc_STRVAR(_msi_Record_GetFieldCount__doc__,
+"GetFieldCount($self, /)\n"
+"--\n"
+"\n"
+"Return the number of fields of the record.");
+
+#define _MSI_RECORD_GETFIELDCOUNT_METHODDEF \
+ {"GetFieldCount", (PyCFunction)_msi_Record_GetFieldCount, METH_NOARGS, _msi_Record_GetFieldCount__doc__},
+
+static PyObject *
+_msi_Record_GetFieldCount_impl(msiobj *self);
+
+static PyObject *
+_msi_Record_GetFieldCount(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_Record_GetFieldCount_impl(self);
+}
+
+PyDoc_STRVAR(_msi_Record_GetInteger__doc__,
+"GetInteger($self, field, /)\n"
+"--\n"
+"\n"
+"Return the value of field as an integer where possible.");
+
+#define _MSI_RECORD_GETINTEGER_METHODDEF \
+ {"GetInteger", (PyCFunction)_msi_Record_GetInteger, METH_O, _msi_Record_GetInteger__doc__},
+
+static PyObject *
+_msi_Record_GetInteger_impl(msiobj *self, unsigned int field);
+
+static PyObject *
+_msi_Record_GetInteger(msiobj *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ unsigned int field;
+
+ field = (unsigned int)PyLong_AsUnsignedLongMask(arg);
+ if (field == (unsigned int)-1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = _msi_Record_GetInteger_impl(self, field);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_Record_GetString__doc__,
+"GetString($self, field, /)\n"
+"--\n"
+"\n"
+"Return the value of field as a string where possible.");
+
+#define _MSI_RECORD_GETSTRING_METHODDEF \
+ {"GetString", (PyCFunction)_msi_Record_GetString, METH_O, _msi_Record_GetString__doc__},
+
+static PyObject *
+_msi_Record_GetString_impl(msiobj *self, unsigned int field);
+
+static PyObject *
+_msi_Record_GetString(msiobj *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ unsigned int field;
+
+ field = (unsigned int)PyLong_AsUnsignedLongMask(arg);
+ if (field == (unsigned int)-1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = _msi_Record_GetString_impl(self, field);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_Record_ClearData__doc__,
+"ClearData($self, /)\n"
+"--\n"
+"\n"
+"Set all fields of the record to 0.");
+
+#define _MSI_RECORD_CLEARDATA_METHODDEF \
+ {"ClearData", (PyCFunction)_msi_Record_ClearData, METH_NOARGS, _msi_Record_ClearData__doc__},
+
+static PyObject *
+_msi_Record_ClearData_impl(msiobj *self);
+
+static PyObject *
+_msi_Record_ClearData(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_Record_ClearData_impl(self);
+}
+
+PyDoc_STRVAR(_msi_Record_SetString__doc__,
+"SetString($self, field, value, /)\n"
+"--\n"
+"\n"
+"Set field to a string value.");
+
+#define _MSI_RECORD_SETSTRING_METHODDEF \
+ {"SetString", (PyCFunction)(void(*)(void))_msi_Record_SetString, METH_FASTCALL, _msi_Record_SetString__doc__},
+
+static PyObject *
+_msi_Record_SetString_impl(msiobj *self, int field, const Py_UNICODE *value);
+
+static PyObject *
+_msi_Record_SetString(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int field;
+ const Py_UNICODE *value;
+
+ if (!_PyArg_CheckPositional("SetString", nargs, 2, 2)) {
+ goto exit;
+ }
+ field = _PyLong_AsInt(args[0]);
+ if (field == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[1])) {
+ _PyArg_BadArgument("SetString", "argument 2", "str", args[1]);
+ goto exit;
+ }
+ #if USE_UNICODE_WCHAR_CACHE
+ value = _PyUnicode_AsUnicode(args[1]);
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ value = PyUnicode_AsWideCharString(args[1], NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (value == NULL) {
+ goto exit;
+ }
+ return_value = _msi_Record_SetString_impl(self, field, value);
+
+exit:
+ /* Cleanup for value */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)value);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_Record_SetStream__doc__,
+"SetStream($self, field, value, /)\n"
+"--\n"
+"\n"
+"Set field to the contents of the file named value.");
+
+#define _MSI_RECORD_SETSTREAM_METHODDEF \
+ {"SetStream", (PyCFunction)(void(*)(void))_msi_Record_SetStream, METH_FASTCALL, _msi_Record_SetStream__doc__},
+
+static PyObject *
+_msi_Record_SetStream_impl(msiobj *self, int field, const Py_UNICODE *value);
+
+static PyObject *
+_msi_Record_SetStream(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int field;
+ const Py_UNICODE *value;
+
+ if (!_PyArg_CheckPositional("SetStream", nargs, 2, 2)) {
+ goto exit;
+ }
+ field = _PyLong_AsInt(args[0]);
+ if (field == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[1])) {
+ _PyArg_BadArgument("SetStream", "argument 2", "str", args[1]);
+ goto exit;
+ }
+ #if USE_UNICODE_WCHAR_CACHE
+ value = _PyUnicode_AsUnicode(args[1]);
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ value = PyUnicode_AsWideCharString(args[1], NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (value == NULL) {
+ goto exit;
+ }
+ return_value = _msi_Record_SetStream_impl(self, field, value);
+
+exit:
+ /* Cleanup for value */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)value);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_Record_SetInteger__doc__,
+"SetInteger($self, field, value, /)\n"
+"--\n"
+"\n"
+"Set field to an integer value.");
+
+#define _MSI_RECORD_SETINTEGER_METHODDEF \
+ {"SetInteger", (PyCFunction)(void(*)(void))_msi_Record_SetInteger, METH_FASTCALL, _msi_Record_SetInteger__doc__},
+
+static PyObject *
+_msi_Record_SetInteger_impl(msiobj *self, int field, int value);
+
+static PyObject *
+_msi_Record_SetInteger(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int field;
+ int value;
+
+ if (!_PyArg_CheckPositional("SetInteger", nargs, 2, 2)) {
+ goto exit;
+ }
+ field = _PyLong_AsInt(args[0]);
+ if (field == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ value = _PyLong_AsInt(args[1]);
+ if (value == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = _msi_Record_SetInteger_impl(self, field, value);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_SummaryInformation_GetProperty__doc__,
+"GetProperty($self, field, /)\n"
+"--\n"
+"\n"
+"Return a property of the summary.\n"
+"\n"
+" field\n"
+" the name of the property, one of the PID_* constants");
+
+#define _MSI_SUMMARYINFORMATION_GETPROPERTY_METHODDEF \
+ {"GetProperty", (PyCFunction)_msi_SummaryInformation_GetProperty, METH_O, _msi_SummaryInformation_GetProperty__doc__},
+
+static PyObject *
+_msi_SummaryInformation_GetProperty_impl(msiobj *self, int field);
+
+static PyObject *
+_msi_SummaryInformation_GetProperty(msiobj *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int field;
+
+ field = _PyLong_AsInt(arg);
+ if (field == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = _msi_SummaryInformation_GetProperty_impl(self, field);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_SummaryInformation_GetPropertyCount__doc__,
+"GetPropertyCount($self, /)\n"
+"--\n"
+"\n"
+"Return the number of summary properties.");
+
+#define _MSI_SUMMARYINFORMATION_GETPROPERTYCOUNT_METHODDEF \
+ {"GetPropertyCount", (PyCFunction)_msi_SummaryInformation_GetPropertyCount, METH_NOARGS, _msi_SummaryInformation_GetPropertyCount__doc__},
+
+static PyObject *
+_msi_SummaryInformation_GetPropertyCount_impl(msiobj *self);
+
+static PyObject *
+_msi_SummaryInformation_GetPropertyCount(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_SummaryInformation_GetPropertyCount_impl(self);
+}
+
+PyDoc_STRVAR(_msi_SummaryInformation_SetProperty__doc__,
+"SetProperty($self, field, value, /)\n"
+"--\n"
+"\n"
+"Set a property.\n"
+"\n"
+" field\n"
+" the name of the property, one of the PID_* constants\n"
+" value\n"
+" the new value of the property (integer or string)");
+
+#define _MSI_SUMMARYINFORMATION_SETPROPERTY_METHODDEF \
+ {"SetProperty", (PyCFunction)(void(*)(void))_msi_SummaryInformation_SetProperty, METH_FASTCALL, _msi_SummaryInformation_SetProperty__doc__},
+
+static PyObject *
+_msi_SummaryInformation_SetProperty_impl(msiobj *self, int field,
+ PyObject *data);
+
+static PyObject *
+_msi_SummaryInformation_SetProperty(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int field;
+ PyObject *data;
+
+ if (!_PyArg_CheckPositional("SetProperty", nargs, 2, 2)) {
+ goto exit;
+ }
+ field = _PyLong_AsInt(args[0]);
+ if (field == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ data = args[1];
+ return_value = _msi_SummaryInformation_SetProperty_impl(self, field, data);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_SummaryInformation_Persist__doc__,
+"Persist($self, /)\n"
+"--\n"
+"\n"
+"Write the modified properties to the summary information stream.");
+
+#define _MSI_SUMMARYINFORMATION_PERSIST_METHODDEF \
+ {"Persist", (PyCFunction)_msi_SummaryInformation_Persist, METH_NOARGS, _msi_SummaryInformation_Persist__doc__},
+
+static PyObject *
+_msi_SummaryInformation_Persist_impl(msiobj *self);
+
+static PyObject *
+_msi_SummaryInformation_Persist(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_SummaryInformation_Persist_impl(self);
+}
+
+PyDoc_STRVAR(_msi_View_Execute__doc__,
+"Execute($self, params, /)\n"
+"--\n"
+"\n"
+"Execute the SQL query of the view.\n"
+"\n"
+" params\n"
+" a record describing actual values of the parameter tokens\n"
+" in the query or None");
+
+#define _MSI_VIEW_EXECUTE_METHODDEF \
+ {"Execute", (PyCFunction)_msi_View_Execute, METH_O, _msi_View_Execute__doc__},
+
+PyDoc_STRVAR(_msi_View_Fetch__doc__,
+"Fetch($self, /)\n"
+"--\n"
+"\n"
+"Return a result record of the query.");
+
+#define _MSI_VIEW_FETCH_METHODDEF \
+ {"Fetch", (PyCFunction)_msi_View_Fetch, METH_NOARGS, _msi_View_Fetch__doc__},
+
+static PyObject *
+_msi_View_Fetch_impl(msiobj *self);
+
+static PyObject *
+_msi_View_Fetch(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_View_Fetch_impl(self);
+}
+
+PyDoc_STRVAR(_msi_View_GetColumnInfo__doc__,
+"GetColumnInfo($self, kind, /)\n"
+"--\n"
+"\n"
+"Return a record describing the columns of the view.\n"
+"\n"
+" kind\n"
+" MSICOLINFO_NAMES or MSICOLINFO_TYPES");
+
+#define _MSI_VIEW_GETCOLUMNINFO_METHODDEF \
+ {"GetColumnInfo", (PyCFunction)_msi_View_GetColumnInfo, METH_O, _msi_View_GetColumnInfo__doc__},
+
+static PyObject *
+_msi_View_GetColumnInfo_impl(msiobj *self, int kind);
+
+static PyObject *
+_msi_View_GetColumnInfo(msiobj *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int kind;
+
+ kind = _PyLong_AsInt(arg);
+ if (kind == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = _msi_View_GetColumnInfo_impl(self, kind);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_View_Modify__doc__,
+"Modify($self, kind, data, /)\n"
+"--\n"
+"\n"
+"Modify the view.\n"
+"\n"
+" kind\n"
+" one of the MSIMODIFY_* constants\n"
+" data\n"
+" a record describing the new data");
+
+#define _MSI_VIEW_MODIFY_METHODDEF \
+ {"Modify", (PyCFunction)(void(*)(void))_msi_View_Modify, METH_FASTCALL, _msi_View_Modify__doc__},
+
+static PyObject *
+_msi_View_Modify_impl(msiobj *self, int kind, PyObject *data);
+
+static PyObject *
+_msi_View_Modify(msiobj *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ int kind;
+ PyObject *data;
+
+ if (!_PyArg_CheckPositional("Modify", nargs, 2, 2)) {
+ goto exit;
+ }
+ kind = _PyLong_AsInt(args[0]);
+ if (kind == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ data = args[1];
+ return_value = _msi_View_Modify_impl(self, kind, data);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_View_Close__doc__,
+"Close($self, /)\n"
+"--\n"
+"\n"
+"Close the view.");
+
+#define _MSI_VIEW_CLOSE_METHODDEF \
+ {"Close", (PyCFunction)_msi_View_Close, METH_NOARGS, _msi_View_Close__doc__},
+
+static PyObject *
+_msi_View_Close_impl(msiobj *self);
+
+static PyObject *
+_msi_View_Close(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_View_Close_impl(self);
+}
+
+PyDoc_STRVAR(_msi_Database_OpenView__doc__,
+"OpenView($self, sql, /)\n"
+"--\n"
+"\n"
+"Return a view object.\n"
+"\n"
+" sql\n"
+" the SQL statement to execute");
+
+#define _MSI_DATABASE_OPENVIEW_METHODDEF \
+ {"OpenView", (PyCFunction)_msi_Database_OpenView, METH_O, _msi_Database_OpenView__doc__},
+
+static PyObject *
+_msi_Database_OpenView_impl(msiobj *self, const Py_UNICODE *sql);
+
+static PyObject *
+_msi_Database_OpenView(msiobj *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ const Py_UNICODE *sql;
+
+ if (!PyUnicode_Check(arg)) {
+ _PyArg_BadArgument("OpenView", "argument", "str", arg);
+ goto exit;
+ }
+ #if USE_UNICODE_WCHAR_CACHE
+ sql = _PyUnicode_AsUnicode(arg);
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ sql = PyUnicode_AsWideCharString(arg, NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (sql == NULL) {
+ goto exit;
+ }
+ return_value = _msi_Database_OpenView_impl(self, sql);
+
+exit:
+ /* Cleanup for sql */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)sql);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_Database_Commit__doc__,
+"Commit($self, /)\n"
+"--\n"
+"\n"
+"Commit the changes pending in the current transaction.");
+
+#define _MSI_DATABASE_COMMIT_METHODDEF \
+ {"Commit", (PyCFunction)_msi_Database_Commit, METH_NOARGS, _msi_Database_Commit__doc__},
+
+static PyObject *
+_msi_Database_Commit_impl(msiobj *self);
+
+static PyObject *
+_msi_Database_Commit(msiobj *self, PyObject *Py_UNUSED(ignored))
+{
+ return _msi_Database_Commit_impl(self);
+}
+
+PyDoc_STRVAR(_msi_Database_GetSummaryInformation__doc__,
+"GetSummaryInformation($self, count, /)\n"
+"--\n"
+"\n"
+"Return a new summary information object.\n"
+"\n"
+" count\n"
+" the maximum number of updated values");
+
+#define _MSI_DATABASE_GETSUMMARYINFORMATION_METHODDEF \
+ {"GetSummaryInformation", (PyCFunction)_msi_Database_GetSummaryInformation, METH_O, _msi_Database_GetSummaryInformation__doc__},
+
+static PyObject *
+_msi_Database_GetSummaryInformation_impl(msiobj *self, int count);
+
+static PyObject *
+_msi_Database_GetSummaryInformation(msiobj *self, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int count;
+
+ count = _PyLong_AsInt(arg);
+ if (count == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = _msi_Database_GetSummaryInformation_impl(self, count);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_OpenDatabase__doc__,
+"OpenDatabase($module, path, persist, /)\n"
+"--\n"
+"\n"
+"Return a new database object.\n"
+"\n"
+" path\n"
+" the file name of the MSI file\n"
+" persist\n"
+" the persistence mode");
+
+#define _MSI_OPENDATABASE_METHODDEF \
+ {"OpenDatabase", (PyCFunction)(void(*)(void))_msi_OpenDatabase, METH_FASTCALL, _msi_OpenDatabase__doc__},
+
+static PyObject *
+_msi_OpenDatabase_impl(PyObject *module, const Py_UNICODE *path, int persist);
+
+static PyObject *
+_msi_OpenDatabase(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ const Py_UNICODE *path;
+ int persist;
+
+ if (!_PyArg_CheckPositional("OpenDatabase", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("OpenDatabase", "argument 1", "str", args[0]);
+ goto exit;
+ }
+ #if USE_UNICODE_WCHAR_CACHE
+ path = _PyUnicode_AsUnicode(args[0]);
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ path = PyUnicode_AsWideCharString(args[0], NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (path == NULL) {
+ goto exit;
+ }
+ persist = _PyLong_AsInt(args[1]);
+ if (persist == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = _msi_OpenDatabase_impl(module, path, persist);
+
+exit:
+ /* Cleanup for path */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)path);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
+ return return_value;
+}
+
+PyDoc_STRVAR(_msi_CreateRecord__doc__,
+"CreateRecord($module, count, /)\n"
+"--\n"
+"\n"
+"Return a new record object.\n"
+"\n"
+" count\n"
+" the number of fields of the record");
+
+#define _MSI_CREATERECORD_METHODDEF \
+ {"CreateRecord", (PyCFunction)_msi_CreateRecord, METH_O, _msi_CreateRecord__doc__},
+
+static PyObject *
+_msi_CreateRecord_impl(PyObject *module, int count);
+
+static PyObject *
+_msi_CreateRecord(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ int count;
+
+ count = _PyLong_AsInt(arg);
+ if (count == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = _msi_CreateRecord_impl(module, count);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=49debf733ee5cab2 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/PC/clinic/msvcrtmodule.c.h b/contrib/tools/python3/src/PC/clinic/msvcrtmodule.c.h
index 180c3e5fc54..1ac82cb965b 100644
--- a/contrib/tools/python3/src/PC/clinic/msvcrtmodule.c.h
+++ b/contrib/tools/python3/src/PC/clinic/msvcrtmodule.c.h
@@ -53,29 +53,14 @@ msvcrt_locking(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("locking", nargs, 3, 3)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(args[1]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[2])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
nbytes = PyLong_AsLong(args[2]);
if (nbytes == -1 && PyErr_Occurred()) {
goto exit;
@@ -114,20 +99,10 @@ msvcrt_setmode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!_PyArg_CheckPositional("setmode", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(args[0]);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(args[1]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -201,11 +176,6 @@ msvcrt_get_osfhandle(PyObject *module, PyObject *arg)
int fd;
void *_return_value;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
fd = _PyLong_AsInt(arg);
if (fd == -1 && PyErr_Occurred()) {
goto exit;
@@ -561,20 +531,10 @@ msvcrt_CrtSetReportMode(PyObject *module, PyObject *const *args, Py_ssize_t narg
if (!_PyArg_CheckPositional("CrtSetReportMode", nargs, 2, 2)) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
type = _PyLong_AsInt(args[0]);
if (type == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(args[1]);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -614,11 +574,6 @@ msvcrt_set_error_mode(PyObject *module, PyObject *arg)
int mode;
long _return_value;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = _PyLong_AsInt(arg);
if (mode == -1 && PyErr_Occurred()) {
goto exit;
@@ -635,6 +590,24 @@ exit:
#endif /* defined(_DEBUG) */
+PyDoc_STRVAR(msvcrt_GetErrorMode__doc__,
+"GetErrorMode($module, /)\n"
+"--\n"
+"\n"
+"Wrapper around GetErrorMode.");
+
+#define MSVCRT_GETERRORMODE_METHODDEF \
+ {"GetErrorMode", (PyCFunction)msvcrt_GetErrorMode, METH_NOARGS, msvcrt_GetErrorMode__doc__},
+
+static PyObject *
+msvcrt_GetErrorMode_impl(PyObject *module);
+
+static PyObject *
+msvcrt_GetErrorMode(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+ return msvcrt_GetErrorMode_impl(module);
+}
+
PyDoc_STRVAR(msvcrt_SetErrorMode__doc__,
"SetErrorMode($module, mode, /)\n"
"--\n"
@@ -653,11 +626,6 @@ msvcrt_SetErrorMode(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
unsigned int mode;
- if (PyFloat_Check(arg)) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
mode = (unsigned int)PyLong_AsUnsignedLongMask(arg);
if (mode == (unsigned int)-1 && PyErr_Occurred()) {
goto exit;
@@ -679,4 +647,4 @@ exit:
#ifndef MSVCRT_SET_ERROR_MODE_METHODDEF
#define MSVCRT_SET_ERROR_MODE_METHODDEF
#endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */
-/*[clinic end generated code: output=7cc6ffaf64f268f7 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=20dfbc768edce7c0 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/PC/clinic/winreg.c.h b/contrib/tools/python3/src/PC/clinic/winreg.c.h
index b7af1855ac5..183301f0618 100644
--- a/contrib/tools/python3/src/PC/clinic/winreg.c.h
+++ b/contrib/tools/python3/src/PC/clinic/winreg.c.h
@@ -152,8 +152,27 @@ winreg_ConnectRegistry(PyObject *module, PyObject *const *args, Py_ssize_t nargs
HKEY key;
HKEY _return_value;
- if (!_PyArg_ParseStack(args, nargs, "ZO&:ConnectRegistry",
- &computer_name, clinic_HKEY_converter, &key)) {
+ if (!_PyArg_CheckPositional("ConnectRegistry", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (args[0] == Py_None) {
+ computer_name = NULL;
+ }
+ else if (PyUnicode_Check(args[0])) {
+ #if USE_UNICODE_WCHAR_CACHE
+ computer_name = _PyUnicode_AsUnicode(args[0]);
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ computer_name = PyUnicode_AsWideCharString(args[0], NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (computer_name == NULL) {
+ goto exit;
+ }
+ }
+ else {
+ _PyArg_BadArgument("ConnectRegistry", "argument 1", "str or None", args[0]);
+ goto exit;
+ }
+ if (!clinic_HKEY_converter(args[1], &key)) {
goto exit;
}
_return_value = winreg_ConnectRegistry_impl(module, computer_name, key);
@@ -163,6 +182,11 @@ winreg_ConnectRegistry(PyObject *module, PyObject *const *args, Py_ssize_t nargs
return_value = PyHKEY_FromHKEY(_return_value);
exit:
+ /* Cleanup for computer_name */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)computer_name);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
return return_value;
}
@@ -199,8 +223,27 @@ winreg_CreateKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
const Py_UNICODE *sub_key;
HKEY _return_value;
- if (!_PyArg_ParseStack(args, nargs, "O&Z:CreateKey",
- clinic_HKEY_converter, &key, &sub_key)) {
+ if (!_PyArg_CheckPositional("CreateKey", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (!clinic_HKEY_converter(args[0], &key)) {
+ goto exit;
+ }
+ if (args[1] == Py_None) {
+ sub_key = NULL;
+ }
+ else if (PyUnicode_Check(args[1])) {
+ #if USE_UNICODE_WCHAR_CACHE
+ sub_key = _PyUnicode_AsUnicode(args[1]);
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ sub_key = PyUnicode_AsWideCharString(args[1], NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (sub_key == NULL) {
+ goto exit;
+ }
+ }
+ else {
+ _PyArg_BadArgument("CreateKey", "argument 2", "str or None", args[1]);
goto exit;
}
_return_value = winreg_CreateKey_impl(module, key, sub_key);
@@ -210,6 +253,11 @@ winreg_CreateKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
return_value = PyHKEY_FromHKEY(_return_value);
exit:
+ /* Cleanup for sub_key */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)sub_key);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
return return_value;
}
@@ -251,7 +299,7 @@ winreg_CreateKeyEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"key", "sub_key", "reserved", "access", NULL};
- static _PyArg_Parser _parser = {"O&Z|ii:CreateKeyEx", _keywords, 0};
+ static _PyArg_Parser _parser = {"O&O&|ii:CreateKeyEx", _keywords, 0};
HKEY key;
const Py_UNICODE *sub_key;
int reserved = 0;
@@ -259,7 +307,7 @@ winreg_CreateKeyEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
HKEY _return_value;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- clinic_HKEY_converter, &key, &sub_key, &reserved, &access)) {
+ clinic_HKEY_converter, &key, _PyUnicode_WideCharString_Opt_Converter, &sub_key, &reserved, &access)) {
goto exit;
}
_return_value = winreg_CreateKeyEx_impl(module, key, sub_key, reserved, access);
@@ -269,6 +317,11 @@ winreg_CreateKeyEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
return_value = PyHKEY_FromHKEY(_return_value);
exit:
+ /* Cleanup for sub_key */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)sub_key);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
return return_value;
}
@@ -303,13 +356,32 @@ winreg_DeleteKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
HKEY key;
const Py_UNICODE *sub_key;
- if (!_PyArg_ParseStack(args, nargs, "O&u:DeleteKey",
- clinic_HKEY_converter, &key, &sub_key)) {
+ if (!_PyArg_CheckPositional("DeleteKey", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (!clinic_HKEY_converter(args[0], &key)) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[1])) {
+ _PyArg_BadArgument("DeleteKey", "argument 2", "str", args[1]);
+ goto exit;
+ }
+ #if USE_UNICODE_WCHAR_CACHE
+ sub_key = _PyUnicode_AsUnicode(args[1]);
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ sub_key = PyUnicode_AsWideCharString(args[1], NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (sub_key == NULL) {
goto exit;
}
return_value = winreg_DeleteKey_impl(module, key, sub_key);
exit:
+ /* Cleanup for sub_key */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)sub_key);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
return return_value;
}
@@ -351,19 +423,24 @@ winreg_DeleteKeyEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"key", "sub_key", "access", "reserved", NULL};
- static _PyArg_Parser _parser = {"O&u|ii:DeleteKeyEx", _keywords, 0};
+ static _PyArg_Parser _parser = {"O&O&|ii:DeleteKeyEx", _keywords, 0};
HKEY key;
const Py_UNICODE *sub_key;
REGSAM access = KEY_WOW64_64KEY;
int reserved = 0;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- clinic_HKEY_converter, &key, &sub_key, &access, &reserved)) {
+ clinic_HKEY_converter, &key, _PyUnicode_WideCharString_Converter, &sub_key, &access, &reserved)) {
goto exit;
}
return_value = winreg_DeleteKeyEx_impl(module, key, sub_key, access, reserved);
exit:
+ /* Cleanup for sub_key */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)sub_key);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
return return_value;
}
@@ -391,13 +468,37 @@ winreg_DeleteValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
HKEY key;
const Py_UNICODE *value;
- if (!_PyArg_ParseStack(args, nargs, "O&Z:DeleteValue",
- clinic_HKEY_converter, &key, &value)) {
+ if (!_PyArg_CheckPositional("DeleteValue", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (!clinic_HKEY_converter(args[0], &key)) {
+ goto exit;
+ }
+ if (args[1] == Py_None) {
+ value = NULL;
+ }
+ else if (PyUnicode_Check(args[1])) {
+ #if USE_UNICODE_WCHAR_CACHE
+ value = _PyUnicode_AsUnicode(args[1]);
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ value = PyUnicode_AsWideCharString(args[1], NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (value == NULL) {
+ goto exit;
+ }
+ }
+ else {
+ _PyArg_BadArgument("DeleteValue", "argument 2", "str or None", args[1]);
goto exit;
}
return_value = winreg_DeleteValue_impl(module, key, value);
exit:
+ /* Cleanup for value */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)value);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
return return_value;
}
@@ -435,11 +536,6 @@ winreg_EnumKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!clinic_HKEY_converter(args[0], &key)) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
index = _PyLong_AsInt(args[1]);
if (index == -1 && PyErr_Occurred()) {
goto exit;
@@ -493,11 +589,6 @@ winreg_EnumValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
if (!clinic_HKEY_converter(args[0], &key)) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
index = _PyLong_AsInt(args[1]);
if (index == -1 && PyErr_Occurred()) {
goto exit;
@@ -527,12 +618,26 @@ winreg_ExpandEnvironmentStrings(PyObject *module, PyObject *arg)
PyObject *return_value = NULL;
const Py_UNICODE *string;
- if (!PyArg_Parse(arg, "u:ExpandEnvironmentStrings", &string)) {
+ if (!PyUnicode_Check(arg)) {
+ _PyArg_BadArgument("ExpandEnvironmentStrings", "argument", "str", arg);
+ goto exit;
+ }
+ #if USE_UNICODE_WCHAR_CACHE
+ string = _PyUnicode_AsUnicode(arg);
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ string = PyUnicode_AsWideCharString(arg, NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (string == NULL) {
goto exit;
}
return_value = winreg_ExpandEnvironmentStrings_impl(module, string);
exit:
+ /* Cleanup for string */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)string);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
return return_value;
}
@@ -619,13 +724,48 @@ winreg_LoadKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
const Py_UNICODE *sub_key;
const Py_UNICODE *file_name;
- if (!_PyArg_ParseStack(args, nargs, "O&uu:LoadKey",
- clinic_HKEY_converter, &key, &sub_key, &file_name)) {
+ if (!_PyArg_CheckPositional("LoadKey", nargs, 3, 3)) {
+ goto exit;
+ }
+ if (!clinic_HKEY_converter(args[0], &key)) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[1])) {
+ _PyArg_BadArgument("LoadKey", "argument 2", "str", args[1]);
+ goto exit;
+ }
+ #if USE_UNICODE_WCHAR_CACHE
+ sub_key = _PyUnicode_AsUnicode(args[1]);
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ sub_key = PyUnicode_AsWideCharString(args[1], NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (sub_key == NULL) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[2])) {
+ _PyArg_BadArgument("LoadKey", "argument 3", "str", args[2]);
+ goto exit;
+ }
+ #if USE_UNICODE_WCHAR_CACHE
+ file_name = _PyUnicode_AsUnicode(args[2]);
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ file_name = PyUnicode_AsWideCharString(args[2], NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (file_name == NULL) {
goto exit;
}
return_value = winreg_LoadKey_impl(module, key, sub_key, file_name);
exit:
+ /* Cleanup for sub_key */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)sub_key);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ /* Cleanup for file_name */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)file_name);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
return return_value;
}
@@ -660,7 +800,7 @@ winreg_OpenKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"key", "sub_key", "reserved", "access", NULL};
- static _PyArg_Parser _parser = {"O&Z|ii:OpenKey", _keywords, 0};
+ static _PyArg_Parser _parser = {"O&O&|ii:OpenKey", _keywords, 0};
HKEY key;
const Py_UNICODE *sub_key;
int reserved = 0;
@@ -668,7 +808,7 @@ winreg_OpenKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
HKEY _return_value;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- clinic_HKEY_converter, &key, &sub_key, &reserved, &access)) {
+ clinic_HKEY_converter, &key, _PyUnicode_WideCharString_Opt_Converter, &sub_key, &reserved, &access)) {
goto exit;
}
_return_value = winreg_OpenKey_impl(module, key, sub_key, reserved, access);
@@ -678,6 +818,11 @@ winreg_OpenKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObje
return_value = PyHKEY_FromHKEY(_return_value);
exit:
+ /* Cleanup for sub_key */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)sub_key);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
return return_value;
}
@@ -712,7 +857,7 @@ winreg_OpenKeyEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"key", "sub_key", "reserved", "access", NULL};
- static _PyArg_Parser _parser = {"O&Z|ii:OpenKeyEx", _keywords, 0};
+ static _PyArg_Parser _parser = {"O&O&|ii:OpenKeyEx", _keywords, 0};
HKEY key;
const Py_UNICODE *sub_key;
int reserved = 0;
@@ -720,7 +865,7 @@ winreg_OpenKeyEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
HKEY _return_value;
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- clinic_HKEY_converter, &key, &sub_key, &reserved, &access)) {
+ clinic_HKEY_converter, &key, _PyUnicode_WideCharString_Opt_Converter, &sub_key, &reserved, &access)) {
goto exit;
}
_return_value = winreg_OpenKeyEx_impl(module, key, sub_key, reserved, access);
@@ -730,6 +875,11 @@ winreg_OpenKeyEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyOb
return_value = PyHKEY_FromHKEY(_return_value);
exit:
+ /* Cleanup for sub_key */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)sub_key);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
return return_value;
}
@@ -802,13 +952,37 @@ winreg_QueryValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
HKEY key;
const Py_UNICODE *sub_key;
- if (!_PyArg_ParseStack(args, nargs, "O&Z:QueryValue",
- clinic_HKEY_converter, &key, &sub_key)) {
+ if (!_PyArg_CheckPositional("QueryValue", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (!clinic_HKEY_converter(args[0], &key)) {
+ goto exit;
+ }
+ if (args[1] == Py_None) {
+ sub_key = NULL;
+ }
+ else if (PyUnicode_Check(args[1])) {
+ #if USE_UNICODE_WCHAR_CACHE
+ sub_key = _PyUnicode_AsUnicode(args[1]);
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ sub_key = PyUnicode_AsWideCharString(args[1], NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (sub_key == NULL) {
+ goto exit;
+ }
+ }
+ else {
+ _PyArg_BadArgument("QueryValue", "argument 2", "str or None", args[1]);
goto exit;
}
return_value = winreg_QueryValue_impl(module, key, sub_key);
exit:
+ /* Cleanup for sub_key */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)sub_key);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
return return_value;
}
@@ -841,13 +1015,37 @@ winreg_QueryValueEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
HKEY key;
const Py_UNICODE *name;
- if (!_PyArg_ParseStack(args, nargs, "O&Z:QueryValueEx",
- clinic_HKEY_converter, &key, &name)) {
+ if (!_PyArg_CheckPositional("QueryValueEx", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (!clinic_HKEY_converter(args[0], &key)) {
+ goto exit;
+ }
+ if (args[1] == Py_None) {
+ name = NULL;
+ }
+ else if (PyUnicode_Check(args[1])) {
+ #if USE_UNICODE_WCHAR_CACHE
+ name = _PyUnicode_AsUnicode(args[1]);
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ name = PyUnicode_AsWideCharString(args[1], NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (name == NULL) {
+ goto exit;
+ }
+ }
+ else {
+ _PyArg_BadArgument("QueryValueEx", "argument 2", "str or None", args[1]);
goto exit;
}
return_value = winreg_QueryValueEx_impl(module, key, name);
exit:
+ /* Cleanup for name */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)name);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
return return_value;
}
@@ -885,13 +1083,32 @@ winreg_SaveKey(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
HKEY key;
const Py_UNICODE *file_name;
- if (!_PyArg_ParseStack(args, nargs, "O&u:SaveKey",
- clinic_HKEY_converter, &key, &file_name)) {
+ if (!_PyArg_CheckPositional("SaveKey", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (!clinic_HKEY_converter(args[0], &key)) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[1])) {
+ _PyArg_BadArgument("SaveKey", "argument 2", "str", args[1]);
+ goto exit;
+ }
+ #if USE_UNICODE_WCHAR_CACHE
+ file_name = _PyUnicode_AsUnicode(args[1]);
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ file_name = PyUnicode_AsWideCharString(args[1], NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (file_name == NULL) {
goto exit;
}
return_value = winreg_SaveKey_impl(module, key, file_name);
exit:
+ /* Cleanup for file_name */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)file_name);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
return return_value;
}
@@ -926,8 +1143,7 @@ PyDoc_STRVAR(winreg_SetValue__doc__,
static PyObject *
winreg_SetValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key,
- DWORD type, const Py_UNICODE *value,
- Py_ssize_clean_t value_length);
+ DWORD type, PyObject *value_obj);
static PyObject *
winreg_SetValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
@@ -936,16 +1152,20 @@ winreg_SetValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
HKEY key;
const Py_UNICODE *sub_key;
DWORD type;
- const Py_UNICODE *value;
- Py_ssize_clean_t value_length;
+ PyObject *value_obj;
- if (!_PyArg_ParseStack(args, nargs, "O&Zku#:SetValue",
- clinic_HKEY_converter, &key, &sub_key, &type, &value, &value_length)) {
+ if (!_PyArg_ParseStack(args, nargs, "O&O&kU:SetValue",
+ clinic_HKEY_converter, &key, _PyUnicode_WideCharString_Opt_Converter, &sub_key, &type, &value_obj)) {
goto exit;
}
- return_value = winreg_SetValue_impl(module, key, sub_key, type, value, value_length);
+ return_value = winreg_SetValue_impl(module, key, sub_key, type, value_obj);
exit:
+ /* Cleanup for sub_key */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)sub_key);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
return return_value;
}
@@ -1010,13 +1230,18 @@ winreg_SetValueEx(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
DWORD type;
PyObject *value;
- if (!_PyArg_ParseStack(args, nargs, "O&ZOkO:SetValueEx",
- clinic_HKEY_converter, &key, &value_name, &reserved, &type, &value)) {
+ if (!_PyArg_ParseStack(args, nargs, "O&O&OkO:SetValueEx",
+ clinic_HKEY_converter, &key, _PyUnicode_WideCharString_Opt_Converter, &value_name, &reserved, &type, &value)) {
goto exit;
}
return_value = winreg_SetValueEx_impl(module, key, value_name, reserved, type, value);
exit:
+ /* Cleanup for value_name */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)value_name);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
return return_value;
}
@@ -1121,4 +1346,4 @@ winreg_QueryReflectionKey(PyObject *module, PyObject *arg)
exit:
return return_value;
}
-/*[clinic end generated code: output=015afbbd690eb59d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=497a2e804821d5c9 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/PC/clinic/winsound.c.h b/contrib/tools/python3/src/PC/clinic/winsound.c.h
index b37db4c6cbc..c5458990baa 100644
--- a/contrib/tools/python3/src/PC/clinic/winsound.c.h
+++ b/contrib/tools/python3/src/PC/clinic/winsound.c.h
@@ -34,11 +34,6 @@ winsound_PlaySound(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
goto exit;
}
sound = args[0];
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
flags = _PyLong_AsInt(args[1]);
if (flags == -1 && PyErr_Occurred()) {
goto exit;
@@ -81,20 +76,10 @@ winsound_Beep(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
if (!args) {
goto exit;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
frequency = _PyLong_AsInt(args[0]);
if (frequency == -1 && PyErr_Occurred()) {
goto exit;
}
- if (PyFloat_Check(args[1])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
duration = _PyLong_AsInt(args[1]);
if (duration == -1 && PyErr_Occurred()) {
goto exit;
@@ -136,11 +121,6 @@ winsound_MessageBeep(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
if (!noptargs) {
goto skip_optional_pos;
}
- if (PyFloat_Check(args[0])) {
- PyErr_SetString(PyExc_TypeError,
- "integer argument expected, got float" );
- goto exit;
- }
type = _PyLong_AsInt(args[0]);
if (type == -1 && PyErr_Occurred()) {
goto exit;
@@ -151,4 +131,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=28d1cd033282723d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=16b3c1a96861cd3a input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/src/PC/msvcrtmodule.c b/contrib/tools/python3/src/PC/msvcrtmodule.c
index faceb03fba3..0591497871c 100644
--- a/contrib/tools/python3/src/PC/msvcrtmodule.c
+++ b/contrib/tools/python3/src/PC/msvcrtmodule.c
@@ -177,19 +177,11 @@ static long
msvcrt_open_osfhandle_impl(PyObject *module, void *handle, int flags)
/*[clinic end generated code: output=b2fb97c4b515e4e6 input=d5db190a307cf4bb]*/
{
- int fd;
-
if (PySys_Audit("msvcrt.open_osfhandle", "Ki", handle, flags) < 0) {
return -1;
}
- _Py_BEGIN_SUPPRESS_IPH
- fd = _open_osfhandle((intptr_t)handle, flags);
- _Py_END_SUPPRESS_IPH
- if (fd == -1)
- PyErr_SetFromErrno(PyExc_OSError);
-
- return fd;
+ return _Py_open_osfhandle(handle, flags);
}
/*[clinic input]
@@ -207,19 +199,11 @@ static void *
msvcrt_get_osfhandle_impl(PyObject *module, int fd)
/*[clinic end generated code: output=aca01dfe24637374 input=5fcfde9b17136aa2]*/
{
- intptr_t handle = -1;
-
if (PySys_Audit("msvcrt.get_osfhandle", "(i)", fd) < 0) {
return NULL;
}
- _Py_BEGIN_SUPPRESS_IPH
- handle = _get_osfhandle(fd);
- _Py_END_SUPPRESS_IPH
- if (handle == -1)
- PyErr_SetFromErrno(PyExc_OSError);
-
- return (HANDLE)handle;
+ return _Py_get_osfhandle(fd);
}
/* Console I/O */
@@ -483,6 +467,25 @@ msvcrt_set_error_mode_impl(PyObject *module, int mode)
#endif /* _DEBUG */
/*[clinic input]
+msvcrt.GetErrorMode
+
+Wrapper around GetErrorMode.
+[clinic start generated code]*/
+
+static PyObject *
+msvcrt_GetErrorMode_impl(PyObject *module)
+/*[clinic end generated code: output=3103fc6145913591 input=5a7fb083b6dd71fd]*/
+{
+ unsigned int res;
+
+ _Py_BEGIN_SUPPRESS_IPH
+ res = GetErrorMode();
+ _Py_END_SUPPRESS_IPH
+
+ return PyLong_FromUnsignedLong(res);
+}
+
+/*[clinic input]
msvcrt.SetErrorMode
mode: unsigned_int(bitwise=True)
@@ -520,6 +523,7 @@ static struct PyMethodDef msvcrt_functions[] = {
MSVCRT_GETCHE_METHODDEF
MSVCRT_PUTCH_METHODDEF
MSVCRT_UNGETCH_METHODDEF
+ MSVCRT_GETERRORMODE_METHODDEF
MSVCRT_SETERRORMODE_METHODDEF
MSVCRT_CRTSETREPORTFILE_METHODDEF
MSVCRT_CRTSETREPORTMODE_METHODDEF
diff --git a/contrib/tools/python3/src/PC/pyconfig.h b/contrib/tools/python3/src/PC/pyconfig.h
index b53ae107e5b..1987a1237a5 100644
--- a/contrib/tools/python3/src/PC/pyconfig.h
+++ b/contrib/tools/python3/src/PC/pyconfig.h
@@ -165,11 +165,11 @@ WIN32 is still required for the locale module.
/* Define like size_t, omitting the "unsigned" */
#ifdef MS_WIN64
-typedef __int64 ssize_t;
+typedef __int64 Py_ssize_t;
#else
-typedef _W64 int ssize_t;
+typedef _W64 int Py_ssize_t;
#endif
-#define HAVE_SSIZE_T 1
+#define HAVE_PY_SSIZE_T 1
#if defined(MS_WIN32) && !defined(MS_WIN64)
#if defined(_M_IX86)
@@ -268,11 +268,11 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
file in their Makefile (other compilers are
generally taken care of by distutils.) */
# if defined(_DEBUG)
-# pragma comment(lib,"python39_d.lib")
+# pragma comment(lib,"python310_d.lib")
# elif defined(Py_LIMITED_API)
# pragma comment(lib,"python3.lib")
# else
-# pragma comment(lib,"python39.lib")
+# pragma comment(lib,"python310.lib")
# endif /* _DEBUG */
# endif /* _MSC_VER */
# endif /* Py_BUILD_CORE */
@@ -289,6 +289,7 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
# define SIZEOF_FPOS_T 8
# define SIZEOF_HKEY 8
# define SIZEOF_SIZE_T 8
+# define ALIGNOF_SIZE_T 8
/* configure.ac defines HAVE_LARGEFILE_SUPPORT iff
sizeof(off_t) > sizeof(long), and sizeof(long long) >= sizeof(off_t).
On Win64 the second condition is not true, but if fpos_t replaces off_t
@@ -303,6 +304,7 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
# define SIZEOF_FPOS_T 8
# define SIZEOF_HKEY 4
# define SIZEOF_SIZE_T 4
+# define ALIGNOF_SIZE_T 4
/* MS VS2005 changes time_t to a 64-bit type on all platforms */
# if defined(_MSC_VER) && _MSC_VER >= 1400
# define SIZEOF_TIME_T 8
@@ -317,6 +319,7 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
#define SIZEOF_SHORT 2
#define SIZEOF_INT 4
#define SIZEOF_LONG 4
+#define ALIGNOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF_DOUBLE 8
#define SIZEOF_FLOAT 4
diff --git a/contrib/tools/python3/src/PC/winreg.c b/contrib/tools/python3/src/PC/winreg.c
index fd1ccb7b83e..004a89a5355 100644
--- a/contrib/tools/python3/src/PC/winreg.c
+++ b/contrib/tools/python3/src/PC/winreg.c
@@ -14,6 +14,7 @@
#define PY_SSIZE_T_CLEAN
#include "Python.h"
+#include "pycore_object.h" // _PyObject_Init()
#include "structmember.h" // PyMemberDef
#include <windows.h>
@@ -111,7 +112,7 @@ typedef struct {
HKEY hkey;
} PyHKEYObject;
-#define PyHKEY_Check(op) ((op)->ob_type == &PyHKEY_Type)
+#define PyHKEY_Check(op) Py_IS_TYPE(op, &PyHKEY_Type)
static char *failMsg = "bad operand type";
@@ -144,7 +145,7 @@ PyHKEY_deallocFunc(PyObject *ob)
PyHKEYObject *obkey = (PyHKEYObject *)ob;
if (obkey->hkey)
RegCloseKey((HKEY)obkey->hkey);
- PyObject_DEL(ob);
+ PyObject_Free(ob);
}
static int
@@ -457,13 +458,12 @@ clinic_HKEY_converter(PyObject *ob, void *p)
PyObject *
PyHKEY_FromHKEY(HKEY h)
{
- PyHKEYObject *op;
-
/* Inline PyObject_New */
- op = (PyHKEYObject *) PyObject_MALLOC(sizeof(PyHKEYObject));
- if (op == NULL)
+ PyHKEYObject *op = (PyHKEYObject *) PyObject_Malloc(sizeof(PyHKEYObject));
+ if (op == NULL) {
return PyErr_NoMemory();
- PyObject_INIT(op, &PyHKEY_Type);
+ }
+ _PyObject_Init((PyObject*)op, &PyHKEY_Type);
op->hkey = h;
return (PyObject *)op;
}
@@ -640,19 +640,25 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
for (j = 0; j < i; j++)
{
PyObject *t;
- wchar_t *wstr;
Py_ssize_t len;
t = PyList_GET_ITEM(value, j);
if (!PyUnicode_Check(t))
return FALSE;
+#if USE_UNICODE_WCHAR_CACHE
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
- wstr = PyUnicode_AsUnicodeAndSize(t, &len);
+ len = PyUnicode_GetSize(t);
+ if (len < 0)
+ return FALSE;
+ len++;
_Py_COMP_DIAG_POP
- if (wstr == NULL)
+#else /* USE_UNICODE_WCHAR_CACHE */
+ len = PyUnicode_AsWideChar(t, NULL, 0);
+ if (len < 0)
return FALSE;
- size += Py_SAFE_DOWNCAST((len + 1) * sizeof(wchar_t),
+#endif /* USE_UNICODE_WCHAR_CACHE */
+ size += Py_SAFE_DOWNCAST(len * sizeof(wchar_t),
size_t, DWORD);
}
@@ -668,20 +674,18 @@ _Py_COMP_DIAG_POP
for (j = 0; j < i; j++)
{
PyObject *t;
- wchar_t *wstr;
Py_ssize_t len;
t = PyList_GET_ITEM(value, j);
-_Py_COMP_DIAG_PUSH
-_Py_COMP_DIAG_IGNORE_DEPR_DECLS
- wstr = PyUnicode_AsUnicodeAndSize(t, &len);
-_Py_COMP_DIAG_POP
- assert(wstr);
- wcscpy(P, wstr);
- P += (len + 1);
+ assert(size > 0);
+ len = PyUnicode_AsWideChar(t, P, size);
+ assert(len >= 0);
+ assert((unsigned)len < size);
+ size -= (DWORD)len + 1;
+ P += len + 1;
}
/* And doubly-terminate the list... */
- *P = '\0';
+ *P = L'\0';
break;
}
case REG_BINARY:
@@ -699,7 +703,7 @@ _Py_COMP_DIAG_POP
PyErr_Format(PyExc_TypeError,
"Objects of type '%s' can not "
"be used as binary registry values",
- value->ob_type->tp_name);
+ Py_TYPE(value)->tp_name);
return FALSE;
}
@@ -1675,7 +1679,7 @@ winreg.SetValue
type: DWORD
An integer that specifies the type of the data. Currently this must
be REG_SZ, meaning only strings are supported.
- value: Py_UNICODE(zeroes=True)
+ value as value_obj: unicode
A string that specifies the new value.
/
@@ -1694,30 +1698,51 @@ KEY_SET_VALUE access.
static PyObject *
winreg_SetValue_impl(PyObject *module, HKEY key, const Py_UNICODE *sub_key,
- DWORD type, const Py_UNICODE *value,
- Py_ssize_clean_t value_length)
-/*[clinic end generated code: output=686bedb1cbb4367b input=2cd2adab79339c53]*/
+ DWORD type, PyObject *value_obj)
+/*[clinic end generated code: output=d4773dc9c372311a input=bf088494ae2d24fd]*/
{
+ Py_ssize_t value_length;
long rc;
if (type != REG_SZ) {
PyErr_SetString(PyExc_TypeError, "type must be winreg.REG_SZ");
return NULL;
}
- if ((size_t)value_length >= PY_DWORD_MAX) {
+
+#if USE_UNICODE_WCHAR_CACHE
+_Py_COMP_DIAG_PUSH
+_Py_COMP_DIAG_IGNORE_DEPR_DECLS
+ const wchar_t *value = PyUnicode_AsUnicodeAndSize(value_obj, &value_length);
+_Py_COMP_DIAG_POP
+#else /* USE_UNICODE_WCHAR_CACHE */
+ wchar_t *value = PyUnicode_AsWideCharString(value_obj, &value_length);
+#endif /* USE_UNICODE_WCHAR_CACHE */
+ if (value == NULL) {
+ return NULL;
+ }
+ if ((Py_ssize_t)(DWORD)value_length != value_length) {
PyErr_SetString(PyExc_OverflowError, "value is too long");
+#if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free(value);
+#endif /* USE_UNICODE_WCHAR_CACHE */
return NULL;
}
if (PySys_Audit("winreg.SetValue", "nunu#",
(Py_ssize_t)key, sub_key, (Py_ssize_t)type,
value, value_length) < 0) {
+#if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free(value);
+#endif /* USE_UNICODE_WCHAR_CACHE */
return NULL;
}
Py_BEGIN_ALLOW_THREADS
rc = RegSetValueW(key, sub_key, REG_SZ, value, (DWORD)(value_length + 1));
Py_END_ALLOW_THREADS
+#if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free(value);
+#endif /* USE_UNICODE_WCHAR_CACHE */
if (rc != ERROR_SUCCESS)
return PyErr_SetFromWindowsErrWithFunction(rc, "RegSetValue");
Py_RETURN_NONE;
@@ -1794,7 +1819,7 @@ winreg_SetValueEx_impl(PyObject *module, HKEY key,
Py_BEGIN_ALLOW_THREADS
rc = RegSetValueExW(key, value_name, 0, type, data, len);
Py_END_ALLOW_THREADS
- PyMem_DEL(data);
+ PyMem_Free(data);
if (rc != ERROR_SUCCESS)
return PyErr_SetFromWindowsErrWithFunction(rc,
"RegSetValueEx");