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
Gwenaël Samain
cython
Commits
f66909db
Commit
f66909db
authored
Nov 01, 2011
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Noargs super() support for cdef classes
parent
e37ac1ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+9
-3
tests/run/py3k_super.pyx
tests/run/py3k_super.pyx
+14
-0
No files found.
Cython/Compiler/ParseTreeTransforms.py
View file @
f66909db
...
...
@@ -2424,11 +2424,11 @@ class TransformBuiltinMethods(EnvTransform):
return
node
# Inject no-args super
def_node
=
self
.
current_scope_node
()
if
(
not
isinstance
(
def_node
,
Nodes
.
DefNode
)
or
if
(
not
isinstance
(
def_node
,
Nodes
.
DefNode
)
or
not
def_node
.
args
or
len
(
self
.
env_stack
)
<
2
):
return
node
class_node
,
class_scope
=
self
.
env_stack
[
-
2
]
if
class_scope
.
is_py_class_scope
and
def_node
.
args
:
if
class_scope
.
is_py_class_scope
:
def_node
.
requires_classobj
=
True
class_node
.
class_cell
.
is_active
=
True
node
.
args
=
[
...
...
@@ -2436,7 +2436,13 @@ class TransformBuiltinMethods(EnvTransform):
node
.
pos
,
is_generator
=
def_node
.
is_generator
),
ExprNodes
.
NameNode
(
node
.
pos
,
name
=
def_node
.
args
[
0
].
name
)
]
return
node
elif
class_scope
.
is_c_class_scope
:
node
.
args
=
[
ExprNodes
.
NameNode
(
node
.
pos
,
name
=
class_node
.
scope
.
name
,
entry
=
class_node
.
entry
),
ExprNodes
.
NameNode
(
node
.
pos
,
name
=
def_node
.
args
[
0
].
name
)
]
return
node
def
visit_SimpleCallNode
(
self
,
node
):
...
...
tests/run/py3k_super.pyx
View file @
f66909db
...
...
@@ -59,3 +59,17 @@ def test_class_cell_empty():
class
EmptyClassCell
(
metaclass
=
Base
):
def
foo
(
self
):
super
()
cdef
class
CClassBase
(
object
):
def
method
(
self
):
return
1
cdef
class
CClassSuper
(
CClassBase
):
"""
>>> CClassSuper().method()
1
"""
def
method
(
self
):
return
super
().
method
()
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