[Python-checkins] r78926 - python/trunk/Python/structmember.c

mark.dickinson python-checkins at python.org
Sat Mar 13 15:18:35 CET 2010


Author: mark.dickinson
Date: Sat Mar 13 15:18:34 2010
New Revision: 78926
Log:
Fix incorrect error checks in structmember.c (backport of r78920 from py3k).
Modified:
 python/trunk/Python/structmember.c
Modified: python/trunk/Python/structmember.c
==============================================================================
--- python/trunk/Python/structmember.c	(original)
+++ python/trunk/Python/structmember.c	Sat Mar 13 15:18:34 2010
@@ -257,12 +257,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");
@@ -286,7 +287,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

AltStyle によって変換されたページ (->オリジナル) /