Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
9eac6b38
Commit
9eac6b38
authored
Dec 27, 2012
by
Brian Curtin
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
07e0e06f
172e4229
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
2 deletions
+23
-2
Lib/test/test_winreg.py
Lib/test/test_winreg.py
+17
-0
Misc/NEWS
Misc/NEWS
+4
-0
PC/winreg.c
PC/winreg.c
+2
-2
No files found.
Lib/test/test_winreg.py
View file @
9eac6b38
...
...
@@ -335,6 +335,23 @@ class LocalWinregTests(BaseWinregTests):
finally
:
DeleteKey
(
HKEY_CURRENT_USER
,
test_key_name
)
def
test_queryvalueex_return_value
(
self
):
# Test for Issue #16759, return unsigned int from QueryValueEx.
# Reg2Py, which gets called by QueryValueEx, was returning a value
# generated by PyLong_FromLong. The implmentation now uses
# PyLong_FromUnsignedLong to match DWORD's size.
try
:
with
CreateKey
(
HKEY_CURRENT_USER
,
test_key_name
)
as
ck
:
self
.
assertNotEqual
(
ck
.
handle
,
0
)
test_val
=
0x80000000
SetValueEx
(
ck
,
"test_name"
,
None
,
REG_DWORD
,
test_val
)
ret_val
,
ret_type
=
QueryValueEx
(
ck
,
"test_name"
)
self
.
assertEqual
(
ret_type
,
REG_DWORD
)
self
.
assertEqual
(
ret_val
,
test_val
)
finally
:
DeleteKey
(
HKEY_CURRENT_USER
,
test_key_name
)
@
unittest
.
skipUnless
(
REMOTE_NAME
,
"Skipping remote registry tests"
)
class
RemoteWinregTests
(
BaseWinregTests
):
...
...
Misc/NEWS
View file @
9eac6b38
...
...
@@ -10,6 +10,10 @@ What's New in Python 3.2.4
Core and Builtins
-----------------
- Issue #16759: Support the full DWORD (unsigned long) range in Reg2Py
when retreiving a REG_DWORD value. This corrects functions like
winreg.QueryValueEx that may have been returning truncated values.
- Issue #14420: Support the full DWORD (unsigned long) range in Py2Reg
when passed a REG_DWORD value. Fixes OverflowError in winreg.SetValueEx.
...
...
PC/winreg.c
View file @
9eac6b38
...
...
@@ -900,9 +900,9 @@ Reg2Py(BYTE *retDataBuf, DWORD retDataSize, DWORD typ)
switch
(
typ
)
{
case
REG_DWORD
:
if
(
retDataSize
==
0
)
obData
=
PyLong_FromLong
(
0
);
obData
=
PyLong_From
Unsigned
Long
(
0
);
else
obData
=
PyLong_FromLong
(
*
(
int
*
)
retDataBuf
);
obData
=
PyLong_From
Unsigned
Long
(
*
(
int
*
)
retDataBuf
);
break
;
case
REG_SZ
:
case
REG_EXPAND_SZ
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment