From 2f0d394ab3a990b9d0d139cf5c5cf0946cf069af Mon Sep 17 00:00:00 2001 From: AN Long Date: Fri, 14 Nov 2025 00:52:09 +0900 Subject: [PATCH 1/6] Update document for winreg.SetValueEx --- Doc/library/winreg.rst | 17 ++++++++++++++++- PC/winreg.c | 3 ++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Doc/library/winreg.rst b/Doc/library/winreg.rst index b150c53735d634..f599195dfba552 100644 --- a/Doc/library/winreg.rst +++ b/Doc/library/winreg.rst @@ -488,7 +488,8 @@ This module offers the following functions: *type* is an integer that specifies the type of the data. See :ref:`Value Types ` for the available types. - *value* is a string that specifies the new value. + *value* is the new value to set. Accepts str, int, list of str, bytes-like object, + or None depending on the *type* parameter. This method can also set additional value and type information for the specified key. The key identified by the key parameter must have been opened with @@ -691,64 +692,78 @@ For more information, see `Registry Value Types .. data:: REG_BINARY Binary data in any form. + You should pass a :term:`bytes-like object` or :const:`None` in Python for this type. .. data:: REG_DWORD 32-bit number. + You should pass an :class:`int` or :const:`None` in Python for this type. .. data:: REG_DWORD_LITTLE_ENDIAN A 32-bit number in little-endian format. Equivalent to :const:`REG_DWORD`. + You should pass an :class:`int` or :const:`None` in Python for this type. .. data:: REG_DWORD_BIG_ENDIAN A 32-bit number in big-endian format. + You should pass an :class:`int` or :const:`None` in Python for this type. .. data:: REG_EXPAND_SZ Null-terminated string containing references to environment variables (``%PATH%``). + You should pass a :class:`str` or :const:`None` in Python for this type. .. data:: REG_LINK A Unicode symbolic link. + You should pass a :term:`bytes-like object` or :const:`None` in Python for this type. .. data:: REG_MULTI_SZ A sequence of null-terminated strings, terminated by two null characters. (Python handles this termination automatically.) + You should pass a :class:`list` of :class:`str` or :const:`None` in Python for this type. .. data:: REG_NONE No defined value type. + You should pass a :term:`bytes-like object` or :const:`None` in Python for this type. .. data:: REG_QWORD A 64-bit number. + You should pass an :class:`int` or :const:`None` in Python for this type. .. versionadded:: 3.6 .. data:: REG_QWORD_LITTLE_ENDIAN A 64-bit number in little-endian format. Equivalent to :const:`REG_QWORD`. + You should pass an :class:`int` or :const:`None` in Python for this type. .. versionadded:: 3.6 .. data:: REG_RESOURCE_LIST A device-driver resource list. + You should pass a :term:`bytes-like object` or :const:`None` in Python for this type. .. data:: REG_FULL_RESOURCE_DESCRIPTOR A hardware setting. + You should pass a :term:`bytes-like object` or :const:`None` in Python for this type. .. data:: REG_RESOURCE_REQUIREMENTS_LIST A hardware resource list. + You should pass a :term:`bytes-like object` or :const:`None` in Python for this type. .. data:: REG_SZ A null-terminated string. + You should pass a :class:`str` or :const:`None` in Python for this type. .. _handle-object: diff --git a/PC/winreg.c b/PC/winreg.c index c1be920fc1d92f..5f25782f73485a 100644 --- a/PC/winreg.c +++ b/PC/winreg.c @@ -1835,7 +1835,8 @@ winreg.SetValueEx REG_RESOURCE_LIST -- A device-driver resource list. REG_SZ -- A null-terminated string. value: object - A string that specifies the new value. + The new value to set. Accepts str, int, list of str, bytes-like object, + or None depending on the type parameter. / Stores data in the value field of an open registry key. From a4446f829af7cea1aba266e688868e7d70e205c6 Mon Sep 17 00:00:00 2001 From: AN Long Date: Sun, 16 Nov 2025 19:51:11 +0900 Subject: [PATCH 2/6] Add winreg.GetValue --- PC/clinic/winreg.c.h | 101 ++++++++++++++++++++++++++++++++++++++++- PC/winreg.c | 105 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 203 insertions(+), 3 deletions(-) diff --git a/PC/clinic/winreg.c.h b/PC/clinic/winreg.c.h index d76a8d8aef8cb8..a342609dbd1766 100644 --- a/PC/clinic/winreg.c.h +++ b/PC/clinic/winreg.c.h @@ -1489,7 +1489,8 @@ PyDoc_STRVAR(winreg_SetValueEx__doc__, " REG_RESOURCE_LIST -- A device-driver resource list.\n" " REG_SZ -- A null-terminated string.\n" " value\n" -" A string that specifies the new value.\n" +" The new value to set. Accepts str, int, list of str, bytes-like object,\n" +" or None depending on the type parameter.\n" "\n" "This method can also set additional value and type information for the\n" "specified key. The key identified by the key parameter must have been\n" @@ -1697,6 +1698,98 @@ winreg_DeleteTree(PyObject *module, PyObject *const *args, Py_ssize_t nargs) #if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) +PyDoc_STRVAR(winreg_GetValue__doc__, +"GetValue($module, key, sub_key, name, flags=winreg.RRF_RT_ANY, /)\n" +"--\n" +"\n" +"Retrieves the type and data for the specified registry value.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +" sub_key\n" +" A string that names the subkey with which the value is associated.\n" +" If this parameter is None or empty, the value will be read from key.\n" +" name\n" +" A string indicating the value to query.\n" +" flags\n" +" Restrict the data type of value to be queried.\n" +"\n" +"Behaves mostly like QueryValueEx(), but you needn\'t OpenKey() and CloseKey()\n" +"if the key is any one of the predefined HKEY_* constants.\n" +"\n" +"The return value is a tuple of the value and the type_id."); + +#define WINREG_GETVALUE_METHODDEF \ + {"GetValue", _PyCFunction_CAST(winreg_GetValue), METH_FASTCALL, winreg_GetValue__doc__}, + +static PyObject * +winreg_GetValue_impl(PyObject *module, HKEY key, const wchar_t *sub_key, + const wchar_t *name, int flags); + +static PyObject * +winreg_GetValue(PyObject *module, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + HKEY key; + const wchar_t *sub_key = NULL; + const wchar_t *name = NULL; + int flags = RRF_RT_ANY; + + if (!_PyArg_CheckPositional("GetValue", nargs, 3, 4)) { + goto exit; + } + if (!clinic_HKEY_converter(_PyModule_GetState(module), args[0], &key)) { + goto exit; + } + if (args[1] == Py_None) { + sub_key = NULL; + } + else if (PyUnicode_Check(args[1])) { + sub_key = PyUnicode_AsWideCharString(args[1], NULL); + if (sub_key == NULL) { + goto exit; + } + } + else { + _PyArg_BadArgument("GetValue", "argument 2", "str or None", args[1]); + goto exit; + } + if (args[2] == Py_None) { + name = NULL; + } + else if (PyUnicode_Check(args[2])) { + name = PyUnicode_AsWideCharString(args[2], NULL); + if (name == NULL) { + goto exit; + } + } + else { + _PyArg_BadArgument("GetValue", "argument 3", "str or None", args[2]); + goto exit; + } + if (nargs < 4) { + goto skip_optional; + } + flags = PyLong_AsInt(args[3]); + if (flags == -1 && PyErr_Occurred()) { + goto exit; + } +skip_optional: + return_value = winreg_GetValue_impl(module, key, sub_key, name, flags); + +exit: + /* Cleanup for sub_key */ + PyMem_Free((void *)sub_key); + /* Cleanup for name */ + PyMem_Free((void *)name); + + return return_value; +} + +#endif /* (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) */ + +#if (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)) && (defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM)) + PyDoc_STRVAR(winreg_QueryReflectionKey__doc__, "QueryReflectionKey($module, key, /)\n" "--\n" @@ -1839,7 +1932,11 @@ winreg_QueryReflectionKey(PyObject *module, PyObject *arg) #define WINREG_DELETETREE_METHODDEF #endif /* !defined(WINREG_DELETETREE_METHODDEF) */ +#ifndef WINREG_GETVALUE_METHODDEF + #define WINREG_GETVALUE_METHODDEF +#endif /* !defined(WINREG_GETVALUE_METHODDEF) */ + #ifndef WINREG_QUERYREFLECTIONKEY_METHODDEF #define WINREG_QUERYREFLECTIONKEY_METHODDEF #endif /* !defined(WINREG_QUERYREFLECTIONKEY_METHODDEF) */ -/*[clinic end generated code: output=ce7e8e38884851fb input=a9049054013a1b77]*/ +/*[clinic end generated code: output=61270aaf14fc8725 input=a9049054013a1b77]*/ diff --git a/PC/winreg.c b/PC/winreg.c index 5f25782f73485a..05fefcffb0bff6 100644 --- a/PC/winreg.c +++ b/PC/winreg.c @@ -1855,7 +1855,7 @@ the configuration registry to help the registry perform efficiently. static PyObject * winreg_SetValueEx_impl(PyObject *module, HKEY key, const wchar_t *value_name, PyObject *reserved, DWORD type, PyObject *value) -/*[clinic end generated code: output=295db04deb456d9e input=900a9e3990bfb196]*/ +/*[clinic end generated code: output=295db04deb456d9e input=2dd9471b4aff5b84]*/ { LONG rc; BYTE *data = NULL; @@ -2033,6 +2033,97 @@ winreg_DeleteTree_impl(PyObject *module, HKEY key, const wchar_t *sub_key) Py_RETURN_NONE; } +/*[clinic input] +winreg.GetValue + + key: HKEY + An already open key, or any one of the predefined HKEY_* constants. + sub_key: Py_UNICODE(accept={str, NoneType}) + A string that names the subkey with which the value is associated. + If this parameter is None or empty, the value will be read from key. + name: Py_UNICODE(accept={str, NoneType}) + A string indicating the value to query. + flags: int(c_default='RRF_RT_ANY') = winreg.RRF_RT_ANY + Restrict the data type of value to be queried. + / + +Retrieves the type and data for the specified registry value. + +Behaves mostly like QueryValueEx(), but you needn't OpenKey() and CloseKey() +if the key is any one of the predefined HKEY_* constants. + +The return value is a tuple of the value and the type_id. +[clinic start generated code]*/ + +static PyObject * +winreg_GetValue_impl(PyObject *module, HKEY key, const wchar_t *sub_key, + const wchar_t *name, int flags) +/*[clinic end generated code: output=31668fd98e5cd5dc input=9f879d56439779e9]*/ +{ + LONG rc; + BYTE *retBuf, *tmp; + DWORD bufSize = 0, retSize; + DWORD typ; + PyObject *obData; + PyObject *result; + + if (PySys_Audit("winreg.GetValue", "nuui", + (Py_ssize_t)key, sub_key, name, flags) < 0) { + return NULL; + } + + /* First call to get the required buffer size */ + Py_BEGIN_ALLOW_THREADS + rc = RegGetValueW(key, sub_key, name, flags, &typ, NULL, &bufSize); + Py_END_ALLOW_THREADS + + if (rc == ERROR_MORE_DATA) { + bufSize = 256; + } + else if (rc != ERROR_SUCCESS) { + return PyErr_SetFromWindowsErrWithFunction(rc, "RegGetValue"); + } + + retBuf = (BYTE *)PyMem_Malloc(bufSize); + if (retBuf == NULL) { + return PyErr_NoMemory(); + } + + /* Second call to get the actual data */ + while (1) { + retSize = bufSize; + Py_BEGIN_ALLOW_THREADS + rc = RegGetValueW(key, sub_key, name, flags, &typ, + (BYTE *)retBuf, &retSize); + Py_END_ALLOW_THREADS + if (rc != ERROR_MORE_DATA) { + break; + } + + bufSize *= 2; + tmp = (char *) PyMem_Realloc(retBuf, bufSize); + if (tmp == NULL) { + PyMem_Free(retBuf); + return PyErr_NoMemory(); + } + retBuf = tmp; + } + + if (rc != ERROR_SUCCESS) { + PyMem_Free(retBuf); + return PyErr_SetFromWindowsErrWithFunction(rc, "RegGetValue"); + } + + obData = Reg2Py(retBuf, retSize, typ); + PyMem_Free(retBuf); + if (obData == NULL) { + return NULL; + } + result = Py_BuildValue("Oi", obData, typ); + Py_DECREF(obData); + return result; +} + /*[clinic input] winreg.QueryReflectionKey @@ -2205,6 +2296,18 @@ exec_module(PyObject *m) ADD_INT(REG_RESOURCE_LIST); ADD_INT(REG_FULL_RESOURCE_DESCRIPTOR); ADD_INT(REG_RESOURCE_REQUIREMENTS_LIST); + ADD_INT(RRF_RT_ANY); + ADD_INT(RRF_RT_DWORD); + ADD_INT(RRF_RT_QWORD); + ADD_INT(RRF_RT_REG_BINARY); + ADD_INT(RRF_RT_REG_EXPAND_SZ); + ADD_INT(RRF_RT_REG_MULTI_SZ); + ADD_INT(RRF_RT_REG_NONE); + ADD_INT(RRF_RT_REG_SZ); + ADD_INT(RRF_NOEXPAND); + ADD_INT(RRF_SUBKEY_WOW6464KEY); + ADD_INT(RRF_SUBKEY_WOW6432KEY); + ADD_INT(RRF_WOW64_MASK); #undef ADD_INT return 0; From e3b84c935dc1ec2185ec1d10044e9d7ea8bffbec Mon Sep 17 00:00:00 2001 From: AN Long Date: Sun, 16 Nov 2025 21:51:14 +0900 Subject: [PATCH 3/6] Add test for winreg.GetValue --- Lib/test/test_winreg.py | 35 +++++++++++++++++++++++++++++++++++ PC/winreg.c | 1 + 2 files changed, 36 insertions(+) diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py index 733d30b3922d35..8b97d28caf06f2 100644 --- a/Lib/test/test_winreg.py +++ b/Lib/test/test_winreg.py @@ -559,6 +559,41 @@ def test_delete_tree(self): with self.assertRaises(OSError): OpenKey(HKEY_CURRENT_USER, test_key_name) + def test_getvalue(self): + test_subkey = test_key_name + "\\GetValueTest" + key = CreateKey(HKEY_CURRENT_USER, test_subkey) + self.addCleanup(CloseKey, key) + self.addCleanup(DeleteTree, HKEY_CURRENT_USER, test_key_name) + + SetValueEx(key, "test_string", 0, REG_SZ, "Hello World") + SetValueEx(key, "test_dword", 0, REG_DWORD, 12345) + SetValueEx(key, "test_binary", 0, REG_BINARY, b"binary_data") + SetValueEx(key, None, 0, REG_SZ, "Default Value") + + result, typ = GetValue(HKEY_CURRENT_USER, test_subkey, "test_string") + self.assertEqual(result, "Hello World") + self.assertEqual(typ, REG_SZ) + + result, typ = GetValue(HKEY_CURRENT_USER, test_subkey, "test_dword") + self.assertEqual(result, 12345) + self.assertEqual(typ, REG_DWORD) + + result, typ = GetValue(HKEY_CURRENT_USER, test_subkey, "test_binary") + self.assertEqual(result, b"binary_data") + self.assertEqual(typ, REG_BINARY) + + result, typ = GetValue(HKEY_CURRENT_USER, test_subkey, None) + self.assertEqual(result, "Default Value") + self.assertEqual(typ, REG_SZ) + + result, typ = GetValue(HKEY_CURRENT_USER, test_subkey, "") + self.assertEqual(result, "Default Value") + self.assertEqual(typ, REG_SZ) + + result, typ = GetValue(HKEY_CURRENT_USER, test_subkey, "test_string", RRF_RT_REG_SZ) + self.assertEqual(result, "Hello World") + self.assertEqual(typ, REG_SZ) + if __name__ == "__main__": if not REMOTE_NAME: diff --git a/PC/winreg.c b/PC/winreg.c index 05fefcffb0bff6..5f9b8faa6806d0 100644 --- a/PC/winreg.c +++ b/PC/winreg.c @@ -2199,6 +2199,7 @@ static struct PyMethodDef winreg_methods[] = { WINREG_SAVEKEY_METHODDEF WINREG_SETVALUE_METHODDEF WINREG_SETVALUEEX_METHODDEF + WINREG_GETVALUE_METHODDEF {NULL}, }; From be5d9765f2967b1cae934ea26e02fb7ff3c4c1c8 Mon Sep 17 00:00:00 2001 From: AN Long Date: Sun, 16 Nov 2025 22:52:24 +0900 Subject: [PATCH 4/6] Update document --- Doc/library/winreg.rst | 113 +++++++++++++++++++++++++++++++++++++++++ PC/winreg.c | 6 ++- 2 files changed, 118 insertions(+), 1 deletion(-) diff --git a/Doc/library/winreg.rst b/Doc/library/winreg.rst index f599195dfba552..753f7b40527cec 100644 --- a/Doc/library/winreg.rst +++ b/Doc/library/winreg.rst @@ -420,6 +420,42 @@ This module offers the following functions: .. audit-event:: winreg.QueryValue key,sub_key,value_name winreg.QueryValueEx +.. function:: GetValue(key, sub_key, value_name, flags=RRF_RT_ANY) + + Retrieves the type and data for a specified registry value without requiring + the key to be opened first. + + *key* is an already open key, or one of the predefined + :ref:`HKEY_* constants `. + + *sub_key* is a string that holds the name of the subkey with which the value + is associated. If this parameter is ``None`` or empty, the value will be read + from the key specified by *key*. + + *value_name* is a string indicating the value to query, or ``None`` for the + default value of the subkey. + + *flags* is an integer that specifies the restrictions on the value type to + be queried (see :ref:`RRF_* constants `). Default is + ``RRF_RT_ANY``. + + The result is a tuple of 2 items: + + +-------+-----------------------------------------+ + | Index | Meaning | + +=======+=========================================+ + | ``0`` | The value of the registry item. | + +-------+-----------------------------------------+ + | ``1`` | An integer giving the registry type for | + | | this value (see table in docs for | + | | :meth:`SetValueEx`) | + +-------+-----------------------------------------+ + + .. audit-event:: winreg.GetValue key,sub_key,value_name,flags winreg.GetValue + + .. versionadded:: next + + .. function:: SaveKey(key, file_name) Saves the specified key, and all its subkeys to the specified file. @@ -766,6 +802,83 @@ For more information, see `Registry Value Types You should pass a :class:`str` or :const:`None` in Python for this type. +.. _rrf-constants: + +RRF_* Constants ++++++++++++++++ + +Registry value retrieval flags used with :func:`GetValue`. + +.. data:: RRF_RT_ANY + + No type restriction. All registry value types will be returned. + + +.. data:: RRF_RT_DWORD + + Restrict query to 32-bit values. + + +.. data:: RRF_RT_QWORD + + Restrict query to 64-bit values. + + +.. data:: RRF_RT_REG_BINARY + + Restrict query to binary data (REG_BINARY). + + +.. data:: RRF_RT_REG_DWORD + + Restrict query to REG_DWORD values. + + +.. data:: RRF_RT_REG_QWORD + + Restrict query to REG_QWORD values. + + +.. data:: RRF_RT_REG_EXPAND_SZ + + Restrict query to expandable strings (REG_EXPAND_SZ). + + +.. data:: RRF_RT_REG_MULTI_SZ + + Restrict query to multi-strings (REG_MULTI_SZ). + + +.. data:: RRF_RT_REG_NONE + + Restrict query to null values (REG_NONE). + + +.. data:: RRF_RT_REG_SZ + + Restrict query to null-terminated strings (REG_SZ). + + +.. data:: RRF_NOEXPAND + + Do not automatically expand environment variables in REG_EXPAND_SZ values. + + +.. data:: RRF_ZEROONFAILURE + + Set buffer contents to zeroes on failure. + + +.. data:: RRF_SUBKEY_WOW6464KEY + + Query the 64-bit registry view on 64-bit Windows. + + +.. data:: RRF_SUBKEY_WOW6432KEY + + Query the 32-bit registry view on 64-bit Windows. + + .. _handle-object: Registry Handle Objects diff --git a/PC/winreg.c b/PC/winreg.c index 5f9b8faa6806d0..90f78feb560a8f 100644 --- a/PC/winreg.c +++ b/PC/winreg.c @@ -68,6 +68,8 @@ PyDoc_STRVAR(module_doc, " specified key in the registry.\n" "QueryValueEx() - Retrieves the type and data for a specified value name\n" " associated with an open registry key.\n" +"GetValue() - Retrieves the type and data for a specified registry value\n" +" without requiring the key to be opened first.\n" "QueryInfoKey() - Returns information about the specified key.\n" "SaveKey() - Saves the specified key, and all its subkeys a file.\n" "SetValue() - Associates a value with a specified key.\n" @@ -2301,14 +2303,16 @@ exec_module(PyObject *m) ADD_INT(RRF_RT_DWORD); ADD_INT(RRF_RT_QWORD); ADD_INT(RRF_RT_REG_BINARY); + ADD_INT(RRF_RT_REG_DWORD); ADD_INT(RRF_RT_REG_EXPAND_SZ); ADD_INT(RRF_RT_REG_MULTI_SZ); ADD_INT(RRF_RT_REG_NONE); + ADD_INT(RRF_RT_REG_QWORD); ADD_INT(RRF_RT_REG_SZ); ADD_INT(RRF_NOEXPAND); + ADD_INT(RRF_ZEROONFAILURE); ADD_INT(RRF_SUBKEY_WOW6464KEY); ADD_INT(RRF_SUBKEY_WOW6432KEY); - ADD_INT(RRF_WOW64_MASK); #undef ADD_INT return 0; From 52121ddbd663ef8fd8eb5aaa96572307ff8d2c0f Mon Sep 17 00:00:00 2001 From: AN Long Date: Sun, 16 Nov 2025 22:56:10 +0900 Subject: [PATCH 5/6] Add news entry --- .../next/Library/2025-11-16-22-53-19.gh-issue-90012.belDmD.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2025-11-16-22-53-19.gh-issue-90012.belDmD.rst diff --git a/Misc/NEWS.d/next/Library/2025-11-16-22-53-19.gh-issue-90012.belDmD.rst b/Misc/NEWS.d/next/Library/2025-11-16-22-53-19.gh-issue-90012.belDmD.rst new file mode 100644 index 00000000000000..9c12cf69b2b93e --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-11-16-22-53-19.gh-issue-90012.belDmD.rst @@ -0,0 +1,2 @@ +Add :func:`winreg.GetValue` function to retrieve registry values without opening +keys first. Includes RRF_* constants for type restriction flags. From c1bf8a0e0d3973ac1239c8bed8b132f9b8e311b9 Mon Sep 17 00:00:00 2001 From: AN Long Date: Sun, 16 Nov 2025 23:33:06 +0900 Subject: [PATCH 6/6] Revert codes commited in other branch --- PC/clinic/winreg.c.h | 5 ++--- PC/winreg.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/PC/clinic/winreg.c.h b/PC/clinic/winreg.c.h index a342609dbd1766..7260c30915fe8a 100644 --- a/PC/clinic/winreg.c.h +++ b/PC/clinic/winreg.c.h @@ -1489,8 +1489,7 @@ PyDoc_STRVAR(winreg_SetValueEx__doc__, " REG_RESOURCE_LIST -- A device-driver resource list.\n" " REG_SZ -- A null-terminated string.\n" " value\n" -" The new value to set. Accepts str, int, list of str, bytes-like object,\n" -" or None depending on the type parameter.\n" +" A string that specifies the new value.\n" "\n" "This method can also set additional value and type information for the\n" "specified key. The key identified by the key parameter must have been\n" @@ -1939,4 +1938,4 @@ winreg_QueryReflectionKey(PyObject *module, PyObject *arg) #ifndef WINREG_QUERYREFLECTIONKEY_METHODDEF #define WINREG_QUERYREFLECTIONKEY_METHODDEF #endif /* !defined(WINREG_QUERYREFLECTIONKEY_METHODDEF) */ -/*[clinic end generated code: output=61270aaf14fc8725 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=2d216be22c6219ba input=a9049054013a1b77]*/ diff --git a/PC/winreg.c b/PC/winreg.c index 90f78feb560a8f..ba3c6719285994 100644 --- a/PC/winreg.c +++ b/PC/winreg.c @@ -1837,8 +1837,7 @@ winreg.SetValueEx REG_RESOURCE_LIST -- A device-driver resource list. REG_SZ -- A null-terminated string. value: object - The new value to set. Accepts str, int, list of str, bytes-like object, - or None depending on the type parameter. + A string that specifies the new value. / Stores data in the value field of an open registry key. @@ -1857,7 +1856,7 @@ the configuration registry to help the registry perform efficiently. static PyObject * winreg_SetValueEx_impl(PyObject *module, HKEY key, const wchar_t *value_name, PyObject *reserved, DWORD type, PyObject *value) -/*[clinic end generated code: output=295db04deb456d9e input=2dd9471b4aff5b84]*/ +/*[clinic end generated code: output=295db04deb456d9e input=900a9e3990bfb196]*/ { LONG rc; BYTE *data = NULL;