Index: Python/getargs.c =================================================================== --- Python/getargs.c (revision 61411) +++ Python/getargs.c (working copy) @@ -823,7 +823,7 @@ } else return converterr("string", arg, msgbuf, bufsize); - if ((Py_ssize_t)strlen(*p) != PyUnicode_GetSize(arg)) + if ((Py_ssize_t)strlen(*p) != PyString_GET_SIZE(uarg)) return converterr("string without null bytes", arg, msgbuf, bufsize); } @@ -875,8 +875,10 @@ if (arg == Py_None) *p = 0; - else if (PyString_Check(arg)) + else if (PyString_Check(arg)) { *p = PyString_AS_STRING(arg); + uarg = arg; + } else if (PyUnicode_Check(arg)) { uarg = UNICODE_DEFAULT_ENCODING(arg); if (uarg == NULL) @@ -899,7 +901,7 @@ format++; } else if (*p != NULL && - (Py_ssize_t)strlen(*p) != PyUnicode_GetSize(arg)) + (Py_ssize_t)strlen(*p) != PyString_GET_SIZE(uarg)) return converterr( "string without null bytes or None", arg, msgbuf, bufsize);