Commit 5266b9c9 authored by da-woods's avatar da-woods Committed by GitHub

"Fix" an exception formatting issue on Py2 (#5018)

parent d0b95046
...@@ -660,9 +660,17 @@ static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, P ...@@ -660,9 +660,17 @@ static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, P
self = PyTuple_GetItem(args, 0); self = PyTuple_GetItem(args, 0);
if (unlikely(!self)) { if (unlikely(!self)) {
Py_DECREF(new_args); Py_DECREF(new_args);
#if PY_MAJOR_VERSION > 2
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"unbound method %.200S() needs an argument", "unbound method %.200S() needs an argument",
cyfunc->func_qualname); cyfunc->func_qualname);
#else
// %S doesn't work in PyErr_Format on Py2 and replicating
// the formatting seems more trouble than it's worth
// (so produce a less useful error message).
PyErr_SetString(PyExc_TypeError,
"unbound method needs an argument");
#endif
return NULL; 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