Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
5cd417c3
Commit
5cd417c3
authored
May 16, 2022
by
da-woods
Committed by
GitHub
May 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change IndexError to TypeError when calling unbound CyFunctions (GH-4783)
parent
28857fd6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
Cython/Utility/CythonFunction.c
Cython/Utility/CythonFunction.c
+3
-0
tests/run/cyfunction.pyx
tests/run/cyfunction.pyx
+6
-0
No files found.
Cython/Utility/CythonFunction.c
View file @
5cd417c3
...
@@ -660,6 +660,9 @@ static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, P
...
@@ -660,6 +660,9 @@ 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
);
PyErr_Format
(
PyExc_TypeError
,
"unbound method %.200S() needs an argument"
,
cyfunc
->
func_qualname
);
return
NULL
;
return
NULL
;
}
}
...
...
tests/run/cyfunction.pyx
View file @
5cd417c3
...
@@ -363,6 +363,9 @@ cdef class TestUnboundMethodCdef:
...
@@ -363,6 +363,9 @@ cdef class TestUnboundMethodCdef:
>>> C = TestUnboundMethodCdef
>>> C = TestUnboundMethodCdef
>>> IS_PY2 or (C.meth is C.__dict__["meth"])
>>> IS_PY2 or (C.meth is C.__dict__["meth"])
True
True
>>> TestUnboundMethodCdef.meth() # doctest:+ELLIPSIS
Traceback (most recent call last):
TypeError: ...
"""
"""
def
meth
(
self
):
pass
def
meth
(
self
):
pass
...
@@ -372,6 +375,9 @@ class TestUnboundMethod:
...
@@ -372,6 +375,9 @@ class TestUnboundMethod:
>>> C = TestUnboundMethod
>>> C = TestUnboundMethod
>>> IS_PY2 or (C.meth is C.__dict__["meth"])
>>> IS_PY2 or (C.meth is C.__dict__["meth"])
True
True
>>> TestUnboundMethod.meth() # doctest:+ELLIPSIS
Traceback (most recent call last):
TypeError: ...
"""
"""
def
meth
(
self
):
pass
def
meth
(
self
):
pass
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment