diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2007-08-31 05:20:36 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2007-08-31 05:20:36 (GMT) |
commit | b879f57b328cd5fdad1190559c3bf5c890b47a16 (patch) | |
tree | 0ea77848e9c03e9064e4a36fe180a7dd3b5f7874 /Python | |
parent | 1fe5f388529dcdf674d53f7d67abc16c9c6ca5e5 (diff) | |
download | cpython-b879f57b328cd5fdad1190559c3bf5c890b47a16.zip cpython-b879f57b328cd5fdad1190559c3bf5c890b47a16.tar.gz cpython-b879f57b328cd5fdad1190559c3bf5c890b47a16.tar.bz2 |
Try to fix the problem of passing a non-int on Win64 right this time.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/getargs.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Python/getargs.c b/Python/getargs.c index ac85a6d..f11649a 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<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; |