mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Try to fix the problem of passing a non-int on Win64 right this time.
This commit is contained in:
parent
1fe5f38852
commit
b879f57b32
1 changed files with 5 additions and 2 deletions
|
@ -665,10 +665,13 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
|
||||||
case 'n': /* Py_ssize_t */
|
case 'n': /* Py_ssize_t */
|
||||||
#if SIZEOF_SIZE_T != SIZEOF_LONG
|
#if SIZEOF_SIZE_T != SIZEOF_LONG
|
||||||
{
|
{
|
||||||
|
PyObject *iobj;
|
||||||
Py_ssize_t *p = va_arg(*p_va, Py_ssize_t *);
|
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))
|
if (float_argument_error(arg))
|
||||||
return converterr("integer<n>", arg, msgbuf, bufsize);
|
return converterr("integer<n>", arg, msgbuf, bufsize);
|
||||||
|
iobj = PyNumber_Index(arg);
|
||||||
|
if (iobj != NULL)
|
||||||
ival = PyNumber_AsSsize_t(arg);
|
ival = PyNumber_AsSsize_t(arg);
|
||||||
if (ival == -1 && PyErr_Occurred())
|
if (ival == -1 && PyErr_Occurred())
|
||||||
return converterr("integer<n>", arg, msgbuf, bufsize);
|
return converterr("integer<n>", arg, msgbuf, bufsize);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue