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
4ad434de
Commit
4ad434de
authored
Dec 27, 2012
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Plain Diff
Null merge.
parents
b780712b
fdcb6215
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
Lib/test/test_winreg.py
Lib/test/test_winreg.py
+12
-0
Misc/NEWS
Misc/NEWS
+4
-0
PC/_winreg.c
PC/_winreg.c
+6
-5
No files found.
Lib/test/test_winreg.py
View file @
4ad434de
...
...
@@ -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
):
...
...
Misc/NEWS
View file @
4ad434de
...
...
@@ -9,6 +9,10 @@ What's New in Python 2.7.4
Core and Builtins
-----------------
- Issue #14420: Support the full DWORD (unsigned long) range in Py2Reg
when passed a REG_DWORD value. Fixes ValueError in winreg.SetValueEx when
given a long.
- Issue #13863: Work around buggy '
fstat
' implementation on Windows / NTFS that
lead to incorrect timestamps (off by one hour) being stored in .pyc files on
some systems.
...
...
PC/_winreg.c
View file @
4ad434de
...
...
@@ -753,7 +753,8 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
Py_ssize_t
i
,
j
;
switch
(
typ
)
{
case
REG_DWORD
:
if
(
value
!=
Py_None
&&
!
PyInt_Check
(
value
))
if
(
value
!=
Py_None
&&
!
(
PyInt_Check
(
value
)
||
PyLong_Check
(
value
)))
return
FALSE
;
*
retDataBuf
=
(
BYTE
*
)
PyMem_NEW
(
DWORD
,
1
);
if
(
*
retDataBuf
==
NULL
){
...
...
@@ -765,10 +766,10 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
DWORD
zero
=
0
;
memcpy
(
*
retDataBuf
,
&
zero
,
sizeof
(
DWORD
));
}
else
memcpy
(
*
retDataBuf
,
&
PyInt_AS_LONG
((
PyIntObject
*
)
value
),
sizeof
(
DWORD
));
else
{
DWORD
d
=
PyLong_AsUnsignedLong
(
value
);
memcpy
(
*
retDataBuf
,
&
d
,
sizeof
(
DWORD
));
}
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