mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Fix #14420. Check for PyLong as well as PyInt when converting in Py2Reg.
This fixes a ValueError seen in winreg.SetValueEx when passed long winreg.REG_DWORD values that should be supported by the underlying API.
This commit is contained in:
parent
4a5a4c2808
commit
0e091b0365
3 changed files with 22 additions and 5 deletions
|
@ -314,6 +314,18 @@ class LocalWinregTests(BaseWinregTests):
|
|||
finally:
|
||||
DeleteKey(HKEY_CURRENT_USER, test_key_name)
|
||||
|
||||
def test_setvalueex_value_range(self):
|
||||
# Test for Issue #14420, accept proper ranges for SetValueEx.
|
||||
# Py2Reg, which gets called by SetValueEx, was using PyLong_AsLong,
|
||||
# thus raising OverflowError. The implementation now uses
|
||||
# PyLong_AsUnsignedLong to match DWORD's size.
|
||||
try:
|
||||
with CreateKey(HKEY_CURRENT_USER, test_key_name) as ck:
|
||||
self.assertNotEqual(ck.handle, 0)
|
||||
SetValueEx(ck, "test_name", None, REG_DWORD, 0x80000000)
|
||||
finally:
|
||||
DeleteKey(HKEY_CURRENT_USER, test_key_name)
|
||||
|
||||
|
||||
@unittest.skipUnless(REMOTE_NAME, "Skipping remote registry tests")
|
||||
class RemoteWinregTests(BaseWinregTests):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue