diff options
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index c010b1b..3b0a66a 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -764,6 +764,13 @@ PyUnicode_FromFormatV(const char *format, va_list vargs) if (*f == 's') ++callcount; } + else if (128 <= (unsigned char)*f) { + PyErr_Format(PyExc_ValueError, + "PyUnicode_FromFormatV() expects an ASCII-encoded format " + "string, got a non-ascii byte: 0x%02x", + (unsigned char)*f); + return NULL; + } } /* step 2: allocate memory for the results of * PyObject_Str()/PyObject_Repr()/PyUnicode_DecodeUTF8() calls */ @@ -1103,13 +1110,6 @@ PyUnicode_FromFormatV(const char *format, va_list vargs) goto end; } } - else if (128 <= (unsigned char)*f) { - PyErr_Format(PyExc_ValueError, - "PyUnicode_FromFormatV() expects an ASCII-encoded format " - "string, got a non-ascii byte: 0x%02x", - (unsigned char)*f); - goto fail; - } else *s++ = *f; } |