Skip to content

Commit 1b473ad

Browse files
committed
Check deprecated warning in test
1 parent 6eae434 commit 1b473ad

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Lib/test/test_winreg.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,15 @@ def test_registry_works_with_options(self):
233233
options=REG_OPTION_VOLATILE)
234234
self._write_test_data(HKEY_CURRENT_USER, CreateKey=ckeo)
235235

236-
okeo = lambda key, sub_key: OpenKeyEx(key, sub_key, REG_OPTION_VOLATILE, KEY_READ)
236+
okeo = lambda key, sub_key: OpenKeyEx(key, sub_key, REG_OPTION_VOLATILE,
237+
KEY_READ)
237238
self._read_test_data(HKEY_CURRENT_USER, OpenKey=okeo)
238239

240+
with self.assertWarns(DeprecationWarning):
241+
okeo = lambda key, sub_key: OpenKeyEx(key, sub_key,
242+
reserved=REG_OPTION_VOLATILE)
243+
self._read_test_data(HKEY_CURRENT_USER, OpenKey=okeo)
244+
239245
self._delete_test_data(HKEY_CURRENT_USER)
240246

241247
def test_create_only(self):

PC/winreg.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,9 +1412,7 @@ winreg.OpenKey -> HKEY
14121412
sub_key: Py_UNICODE(accept={str, NoneType})
14131413
A string that identifies the sub_key to open.
14141414
reserved: int = 0
1415-
A reserved integer that be should zero. If it is not zero,
1416-
it will be used as the options parameter for compatibility reasons.
1417-
Default is zero.
1415+
A reserved integer that must be zero. Default is zero.
14181416
access: REGSAM(c_default='KEY_READ') = winreg.KEY_READ
14191417
An integer that specifies an access mask that describes the desired
14201418
security access for the key. Default is KEY_READ.

0 commit comments

Comments
 (0)