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
Xavier Thompson
cython
Commits
191b9231
Commit
191b9231
authored
Jul 13, 2014
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix infinite recurison when using super with cpdef methods.
This should also be a (small) performance improvement.
parent
a7b4b0f0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
4 deletions
+35
-4
CHANGES.rst
CHANGES.rst
+2
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+13
-0
tests/run/py3k_super.pyx
tests/run/py3k_super.pyx
+20
-4
No files found.
CHANGES.rst
View file @
191b9231
...
...
@@ -84,6 +84,8 @@ Bugs fixed
* Correctly handle ``from cython.submodule cimport name``.
* Fix infinite recursion when using super with cpdef methods.
Other changes
-------------
...
...
Cython/Compiler/Nodes.py
View file @
191b9231
...
...
@@ -2286,6 +2286,7 @@ class CFuncDefNode(FuncDefNode):
"private types"
)
def
call_self_node
(
self
,
omit_optional_args
=
0
,
is_module_scope
=
0
):
# OLD - DELETE
from
.
import
ExprNodes
args
=
self
.
type
.
args
if
omit_optional_args
:
...
...
@@ -2300,6 +2301,18 @@ class CFuncDefNode(FuncDefNode):
c_call
=
ExprNodes
.
SimpleCallNode
(
self
.
pos
,
function
=
cfunc
,
args
=
[
ExprNodes
.
NameNode
(
self
.
pos
,
name
=
n
)
for
n
in
arg_names
[
1
-
is_module_scope
:]],
wrapper_call
=
skip_dispatch
)
return
ReturnStatNode
(
pos
=
self
.
pos
,
return_type
=
PyrexTypes
.
py_object_type
,
value
=
c_call
)
def
call_self_node
(
self
,
omit_optional_args
=
0
,
is_module_scope
=
0
):
from
.
import
ExprNodes
args
=
self
.
type
.
args
if
omit_optional_args
:
args
=
args
[:
len
(
args
)
-
self
.
type
.
optional_arg_count
]
arg_names
=
[
arg
.
name
for
arg
in
args
]
cfunc
=
ExprNodes
.
PythonCapiFunctionNode
(
self
.
pos
,
self
.
entry
.
name
,
self
.
entry
.
func_cname
,
self
.
type
)
cfunc
.
entry
=
self
.
entry
skip_dispatch
=
not
is_module_scope
or
Options
.
lookup_module_cpdef
c_call
=
ExprNodes
.
SimpleCallNode
(
self
.
pos
,
function
=
cfunc
,
args
=
[
ExprNodes
.
NameNode
(
self
.
pos
,
name
=
n
)
for
n
in
arg_names
],
wrapper_call
=
skip_dispatch
)
return
ReturnStatNode
(
pos
=
self
.
pos
,
return_type
=
PyrexTypes
.
py_object_type
,
value
=
c_call
)
def
declare_arguments
(
self
,
env
):
for
arg
in
self
.
type
.
args
:
if
not
arg
.
name
:
...
...
tests/run/py3k_super.pyx
View file @
191b9231
...
...
@@ -63,13 +63,29 @@ def test_class_cell_empty():
cdef
class
CClassBase
(
object
):
def
method
(
self
):
return
1
return
'def'
# cpdef method_cp(self):
# return 'cpdef'
# cdef method_c(self):
# return 'cdef'
# def call_method_c(self):
# return self.method_c()
cdef
class
CClassSu
per
(
CClassBase
):
cdef
class
CClassSu
b
(
CClassBase
):
"""
>>> CClassSu
per
().method()
1
>>> CClassSu
b
().method()
'def'
"""
# >>> CClassSub().method_cp()
# 'cpdef'
# >>> CClassSub().call_method_c()
# 'cdef'
def
method
(
self
):
return
super
().
method
()
# cpdef method_cp(self):
# return super().method_cp()
# cdef method_c(self):
# return super().method_c()
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