From: Neal Norwitz Date: Fri, 31 Aug 2007 05:20:36 +0000 (+0000) Subject: Try to fix the problem of passing a non-int on Win64 right this time. X-Git-Tag: v3.0a1~25 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b879f57b328cd5fdad1190559c3bf5c890b47a16;p=python Try to fix the problem of passing a non-int on Win64 right this time. --- diff --git a/Python/getargs.c b/Python/getargs.c index ac85a6d0de..f11649adee 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -665,11 +665,14 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, 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", 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", arg, msgbuf, bufsize); *p = ival;