Commit 5cd417c3 authored by da-woods's avatar da-woods Committed by GitHub

Change IndexError to TypeError when calling unbound CyFunctions (GH-4783)

parent 28857fd6
......@@ -660,6 +660,9 @@ static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, P
self = PyTuple_GetItem(args, 0);
if (unlikely(!self)) {
Py_DECREF(new_args);
PyErr_Format(PyExc_TypeError,
"unbound method %.200S() needs an argument",
cyfunc->func_qualname);
return NULL;
}
......
......@@ -363,6 +363,9 @@ cdef class TestUnboundMethodCdef:
>>> C = TestUnboundMethodCdef
>>> IS_PY2 or (C.meth is C.__dict__["meth"])
True
>>> TestUnboundMethodCdef.meth() # doctest:+ELLIPSIS
Traceback (most recent call last):
TypeError: ...
"""
def meth(self): pass
......@@ -372,6 +375,9 @@ class TestUnboundMethod:
>>> C = TestUnboundMethod
>>> IS_PY2 or (C.meth is C.__dict__["meth"])
True
>>> TestUnboundMethod.meth() # doctest:+ELLIPSIS
Traceback (most recent call last):
TypeError: ...
"""
def meth(self): pass
......
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