summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index 960c68c..1370e09 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -663,6 +663,7 @@ 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 *);
@@ -671,13 +672,14 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
return converterr("integer<n>", arg, msgbuf, bufsize);
iobj = PyNumber_Index(arg);
if (iobj != NULL)
- ival = PyLong_AsSsize_t(iobj);
+ ival = PyLong_AsSsize_t(arg);
if (ival == -1 && PyErr_Occurred())
return converterr("integer<n>", arg, msgbuf, bufsize);
*p = ival;
break;
}
-
+#endif
+ /* Fall through from 'n' to 'l' if Py_ssize_t is int */
case 'l': {/* long int */
long *p = va_arg(*p_va, long *);
long ival;