[Python-3000-checkins] r57812 - python/branches/py3k/Python/getargs.c

neal.norwitz python-3000-checkins at python.org
Fri Aug 31 07:20:42 CEST 2007


Author: neal.norwitz
Date: Fri Aug 31 07:20:36 2007
New Revision: 57812

Modified:
   python/branches/py3k/Python/getargs.c
Log:
Try to fix the problem of passing a non-int on Win64 right this time.

Modified: python/branches/py3k/Python/getargs.c
==============================================================================
--- python/branches/py3k/Python/getargs.c	(original)
+++ python/branches/py3k/Python/getargs.c	Fri Aug 31 07:20:36 2007
@@ -665,11 +665,14 @@
 	case 'n': /* Py_ssize_t */
 #if SIZEOF_SIZE_T != SIZEOF_LONG
 	{
+		PyObject *iobj;
 		Py_ssize_t *p = va_arg(*p_va, Py_ssize_t *);
-		Py_ssize_t ival;
+		Py_ssize_t ival = -1;
 		if (float_argument_error(arg))
 			return converterr("integer<n>", arg, msgbuf, bufsize);
-		ival = PyNumber_AsSsize_t(arg);
+		iobj = PyNumber_Index(arg);
+		if (iobj != NULL)
+			ival = PyNumber_AsSsize_t(arg);
 		if (ival == -1 && PyErr_Occurred())
 			return converterr("integer<n>", arg, msgbuf, bufsize);
 		*p = ival;


More information about the Python-3000-checkins mailing list