diff options
-rw-r--r-- | Objects/unicodeobject.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 157ea1c..e227fc7 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1204,7 +1204,10 @@ PyObject *_PyUnicode_AsDefaultEncodedString(PyObject *unicode, char* PyUnicode_AsString(PyObject *unicode) { - assert(PyUnicode_Check(unicode)); + if (!PyUnicode_Check(unicode)) { + PyErr_BadArgument(); + return NULL; + } unicode = _PyUnicode_AsDefaultEncodedString(unicode, NULL); if (!unicode) return NULL; |