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
d8b129f2
Commit
d8b129f2
authored
Jul 03, 2014
by
Zachary Ware
Browse files
Options
Browse Files
Download
Plain Diff
Closes #21151: Merge with 3.4
parents
a6237d82
ad4690fc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
+20
-2
Lib/test/test_winreg.py
Lib/test/test_winreg.py
+14
-1
Misc/NEWS
Misc/NEWS
+3
-0
PC/winreg.c
PC/winreg.c
+3
-1
No files found.
Lib/test/test_winreg.py
View file @
d8b129f2
...
@@ -341,7 +341,7 @@ class LocalWinregTests(BaseWinregTests):
...
@@ -341,7 +341,7 @@ class LocalWinregTests(BaseWinregTests):
def
test_queryvalueex_return_value
(
self
):
def
test_queryvalueex_return_value
(
self
):
# Test for Issue #16759, return unsigned int from QueryValueEx.
# Test for Issue #16759, return unsigned int from QueryValueEx.
# Reg2Py, which gets called by QueryValueEx, was returning a value
# Reg2Py, which gets called by QueryValueEx, was returning a value
# generated by PyLong_FromLong. The implmentation now uses
# generated by PyLong_FromLong. The impl
e
mentation now uses
# PyLong_FromUnsignedLong to match DWORD's size.
# PyLong_FromUnsignedLong to match DWORD's size.
try
:
try
:
with
CreateKey
(
HKEY_CURRENT_USER
,
test_key_name
)
as
ck
:
with
CreateKey
(
HKEY_CURRENT_USER
,
test_key_name
)
as
ck
:
...
@@ -354,6 +354,19 @@ class LocalWinregTests(BaseWinregTests):
...
@@ -354,6 +354,19 @@ class LocalWinregTests(BaseWinregTests):
finally
:
finally
:
DeleteKey
(
HKEY_CURRENT_USER
,
test_key_name
)
DeleteKey
(
HKEY_CURRENT_USER
,
test_key_name
)
def
test_setvalueex_crash_with_none_arg
(
self
):
# Test for Issue #21151, segfault when None is passed to SetValueEx
try
:
with
CreateKey
(
HKEY_CURRENT_USER
,
test_key_name
)
as
ck
:
self
.
assertNotEqual
(
ck
.
handle
,
0
)
test_val
=
None
SetValueEx
(
ck
,
"test_name"
,
0
,
REG_BINARY
,
test_val
)
ret_val
,
ret_type
=
QueryValueEx
(
ck
,
"test_name"
)
self
.
assertEqual
(
ret_type
,
REG_BINARY
)
self
.
assertEqual
(
ret_val
,
test_val
)
finally
:
DeleteKey
(
HKEY_CURRENT_USER
,
test_key_name
)
@
unittest
.
skipUnless
(
REMOTE_NAME
,
"Skipping remote registry tests"
)
@
unittest
.
skipUnless
(
REMOTE_NAME
,
"Skipping remote registry tests"
)
...
...
Misc/NEWS
View file @
d8b129f2
...
@@ -103,6 +103,9 @@ Core and Builtins
...
@@ -103,6 +103,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #21151: Fixed a segfault in the winreg module when ``None`` is passed
as a ``REG_BINARY`` value to SetValueEx. Patch by John Ehresman.
- Issue #21090: io.FileIO.readall() does not ignore I/O errors anymore. Before,
- Issue #21090: io.FileIO.readall() does not ignore I/O errors anymore. Before,
it ignored I/O errors if at least the first C call read() succeed.
it ignored I/O errors if at least the first C call read() succeed.
...
...
PC/winreg.c
View file @
d8b129f2
...
@@ -871,8 +871,10 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
...
@@ -871,8 +871,10 @@ Py2Reg(PyObject *value, DWORD typ, BYTE **retDataBuf, DWORD *retDataSize)
/* ALSO handle ALL unknown data types here. Even if we can't
/* ALSO handle ALL unknown data types here. Even if we can't
support it natively, we should handle the bits. */
support it natively, we should handle the bits. */
default:
default:
if
(
value
==
Py_None
)
if
(
value
==
Py_None
)
{
*
retDataSize
=
0
;
*
retDataSize
=
0
;
*
retDataBuf
=
NULL
;
}
else
{
else
{
Py_buffer
view
;
Py_buffer
view
;
...
...
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