diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/getargs.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/getargs.c b/Python/getargs.c index 7d55baeb38..f7a66048fb 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -764,8 +764,12 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, char *p = va_arg(*p_va, char *); if (PyString_Check(arg) && PyString_Size(arg) == 1) *p = PyString_AS_STRING(arg)[0]; + else if (PyUnicode_Check(arg) && + PyUnicode_GET_SIZE(arg) == 1 && + PyUnicode_AS_UNICODE(arg)[0] < 256) + *p = PyUnicode_AS_UNICODE(arg)[0]; else - return converterr("char", arg, msgbuf, bufsize); + return converterr("char < 256", arg, msgbuf, bufsize); break; } |