Skip to content

Commit 2f0d394

Browse files
committed
Update document for winreg.SetValueEx
1 parent 732224e commit 2f0d394

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Doc/library/winreg.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,8 @@ This module offers the following functions:
488488
*type* is an integer that specifies the type of the data. See
489489
:ref:`Value Types <value-types>` for the available types.
490490

491-
*value* is a string that specifies the new value.
491+
*value* is the new value to set. Accepts str, int, list of str, bytes-like object,
492+
or None depending on the *type* parameter.
492493

493494
This method can also set additional value and type information for the specified
494495
key. The key identified by the key parameter must have been opened with
@@ -691,64 +692,78 @@ For more information, see `Registry Value Types
691692
.. data:: REG_BINARY
692693

693694
Binary data in any form.
695+
You should pass a :term:`bytes-like object` or :const:`None` in Python for this type.
694696

695697
.. data:: REG_DWORD
696698

697699
32-bit number.
700+
You should pass an :class:`int` or :const:`None` in Python for this type.
698701

699702
.. data:: REG_DWORD_LITTLE_ENDIAN
700703

701704
A 32-bit number in little-endian format. Equivalent to :const:`REG_DWORD`.
705+
You should pass an :class:`int` or :const:`None` in Python for this type.
702706

703707
.. data:: REG_DWORD_BIG_ENDIAN
704708

705709
A 32-bit number in big-endian format.
710+
You should pass an :class:`int` or :const:`None` in Python for this type.
706711

707712
.. data:: REG_EXPAND_SZ
708713

709714
Null-terminated string containing references to environment
710715
variables (``%PATH%``).
716+
You should pass a :class:`str` or :const:`None` in Python for this type.
711717

712718
.. data:: REG_LINK
713719

714720
A Unicode symbolic link.
721+
You should pass a :term:`bytes-like object` or :const:`None` in Python for this type.
715722

716723
.. data:: REG_MULTI_SZ
717724

718725
A sequence of null-terminated strings, terminated by two null characters.
719726
(Python handles this termination automatically.)
727+
You should pass a :class:`list` of :class:`str` or :const:`None` in Python for this type.
720728

721729
.. data:: REG_NONE
722730

723731
No defined value type.
732+
You should pass a :term:`bytes-like object` or :const:`None` in Python for this type.
724733

725734
.. data:: REG_QWORD
726735

727736
A 64-bit number.
737+
You should pass an :class:`int` or :const:`None` in Python for this type.
728738

729739
.. versionadded:: 3.6
730740

731741
.. data:: REG_QWORD_LITTLE_ENDIAN
732742

733743
A 64-bit number in little-endian format. Equivalent to :const:`REG_QWORD`.
744+
You should pass an :class:`int` or :const:`None` in Python for this type.
734745

735746
.. versionadded:: 3.6
736747

737748
.. data:: REG_RESOURCE_LIST
738749

739750
A device-driver resource list.
751+
You should pass a :term:`bytes-like object` or :const:`None` in Python for this type.
740752

741753
.. data:: REG_FULL_RESOURCE_DESCRIPTOR
742754

743755
A hardware setting.
756+
You should pass a :term:`bytes-like object` or :const:`None` in Python for this type.
744757

745758
.. data:: REG_RESOURCE_REQUIREMENTS_LIST
746759

747760
A hardware resource list.
761+
You should pass a :term:`bytes-like object` or :const:`None` in Python for this type.
748762

749763
.. data:: REG_SZ
750764

751765
A null-terminated string.
766+
You should pass a :class:`str` or :const:`None` in Python for this type.
752767

753768

754769
.. _handle-object:

PC/winreg.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1835,7 +1835,8 @@ winreg.SetValueEx
18351835
REG_RESOURCE_LIST -- A device-driver resource list.
18361836
REG_SZ -- A null-terminated string.
18371837
value: object
1838-
A string that specifies the new value.
1838+
The new value to set. Accepts str, int, list of str, bytes-like object,
1839+
or None depending on the type parameter.
18391840
/
18401841
18411842
Stores data in the value field of an open registry key.

0 commit comments

Comments
 (0)