Kaydet (Commit) e0a0a6e9 authored tarafından Neal Norwitz's avatar Neal Norwitz

Since PyUnicode_AsString is a public API, don't just assert, but do

a regular check and return an error if not unicode.
üst b0d26335
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment