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
252e4003
Commit
252e4003
authored
Mar 13, 2010
by
Mark Dickinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #8014: Fix incorrect error checks in structmember.c, and re-enable
previously failing test_structmember.py tests.
parent
d59b4164
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
Lib/test/test_structmembers.py
Lib/test/test_structmembers.py
+2
-2
Python/structmember.c
Python/structmember.c
+4
-3
No files found.
Lib/test/test_structmembers.py
View file @
252e4003
...
...
@@ -87,8 +87,8 @@ class ReadWriteTests(unittest.TestCase):
'T_BOOL'
,
'T_BYTE'
,
'T_UBYTE'
,
'T_SHORT'
,
'T_USHORT'
,
'T_INT'
,
#
'T_UINT',
'T_LONG'
,
#
'T_ULONG',
'T_INT'
,
'T_UINT'
,
'T_LONG'
,
'T_ULONG'
,
'T_PYSSIZET'
]
...
...
Python/structmember.c
View file @
252e4003
...
...
@@ -187,12 +187,13 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v)
}
case
T_UINT
:{
unsigned
long
ulong_val
=
PyLong_AsUnsignedLong
(
v
);
if
((
ulong_val
==
(
unsigned
int
)
-
1
)
&&
PyErr_Occurred
())
{
if
((
ulong_val
==
(
unsigned
long
)
-
1
)
&&
PyErr_Occurred
())
{
/* XXX: For compatibility, accept negative int values
as well. */
PyErr_Clear
();
ulong_val
=
PyLong_AsLong
(
v
);
if
((
ulong_val
==
(
unsigned
int
)
-
1
)
&&
PyErr_Occurred
())
if
((
ulong_val
==
(
unsigned
long
)
-
1
)
&&
PyErr_Occurred
())
return
-
1
;
*
(
unsigned
int
*
)
addr
=
(
unsigned
int
)
ulong_val
;
WARN
(
"Writing negative value into unsigned field"
);
...
...
@@ -216,7 +217,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v)
as well. */
PyErr_Clear
();
*
(
unsigned
long
*
)
addr
=
PyLong_AsLong
(
v
);
if
((
*
(
unsigned
long
*
)
addr
==
(
unsigned
int
)
-
1
)
if
((
*
(
unsigned
long
*
)
addr
==
(
unsigned
long
)
-
1
)
&&
PyErr_Occurred
())
return
-
1
;
WARN
(
"Writing negative value into unsigned field"
);
...
...
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