Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 55b002f

Browse files
author
Victor Stinner
committed
Merged revisions 81849 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ........ r81849 | victor.stinner | 2010-06-08 23:45:51 +0200 (mar., 08 juin 2010) | 7 lines PyArg_Parse*("Z#") raises an error for unknown type instead of ignoring the error and leave the pointer to the string and the size unchanged (not initialized). Fix also the type in the error message of "Z", "Z#" and "Y" formats. ........
1 parent 93362d4 commit 55b002f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Python/getargs.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,8 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
10481048
*p = PyUnicode_AS_UNICODE(arg);
10491049
STORE_SIZE(PyUnicode_GET_SIZE(arg));
10501050
}
1051+
else
1052+
return converterr("str or None", arg, msgbuf, bufsize);
10511053
format++;
10521054
} else {
10531055
Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **);
@@ -1057,8 +1059,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
10571059
else if (PyUnicode_Check(arg))
10581060
*p = PyUnicode_AS_UNICODE(arg);
10591061
else
1060-
return converterr("string or None",
1061-
arg, msgbuf, bufsize);
1062+
return converterr("str or None", arg, msgbuf, bufsize);
10621063
}
10631064
break;
10641065
}
@@ -1253,7 +1254,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
12531254
if (PyByteArray_Check(arg))
12541255
*p = arg;
12551256
else
1256-
return converterr("buffer", arg, msgbuf, bufsize);
1257+
return converterr("bytearray", arg, msgbuf, bufsize);
12571258
break;
12581259
}
12591260

0 commit comments

Comments
 (0)