[Python-checkins] r78920 - in python/branches/py3k: Lib/test/test_structmembers.py Python/structmember.c
mark.dickinson
python-checkins at python.org
Sat Mar 13 14:23:05 CET 2010
Author: mark.dickinson
Date: Sat Mar 13 14:23:05 2010
New Revision: 78920
Log:
Issue #8014: Fix incorrect error checks in structmember.c, and re-enable
previously failing test_structmember.py tests.
Modified:
python/branches/py3k/Lib/test/test_structmembers.py
python/branches/py3k/Python/structmember.c
Modified: python/branches/py3k/Lib/test/test_structmembers.py
==============================================================================
--- python/branches/py3k/Lib/test/test_structmembers.py (original)
+++ python/branches/py3k/Lib/test/test_structmembers.py Sat Mar 13 14:23:05 2010
@@ -87,8 +87,8 @@
'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'
]
Modified: python/branches/py3k/Python/structmember.c
==============================================================================
--- python/branches/py3k/Python/structmember.c (original)
+++ python/branches/py3k/Python/structmember.c Sat Mar 13 14:23:05 2010
@@ -187,12 +187,13 @@
}
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 @@
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");
More information about the Python-checkins
mailing list