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
Boxiang Sun
cython
Commits
64cb66dd
Commit
64cb66dd
authored
Nov 15, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix qualname calculation crash for c(p)def functions/classes
parent
bd2bc06a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+17
-13
No files found.
Cython/Compiler/ParseTreeTransforms.py
View file @
64cb66dd
...
...
@@ -1827,7 +1827,9 @@ class CalculateQualifiedNamesTransform(EnvTransform):
def
visit_ModuleNode
(
self
,
node
):
self
.
module_name
=
self
.
global_scope
().
qualified_name
self
.
qualified_name
=
[]
self
.
_super
=
super
(
CalculateQualifiedNamesTransform
,
self
)
_super
=
super
(
CalculateQualifiedNamesTransform
,
self
)
self
.
_super_visit_FuncDefNode
=
_super
.
visit_FuncDefNode
self
.
_super_visit_ClassDefNode
=
_super
.
visit_ClassDefNode
self
.
visitchildren
(
node
)
return
node
...
...
@@ -1842,20 +1844,17 @@ class CalculateQualifiedNamesTransform(EnvTransform):
self
.
visitchildren
(
node
)
return
node
def
_append_
name
(
self
,
name
):
if
name
==
'<lambda>'
:
self
.
qualified_name
.
append
(
'<lambda>'
)
def
_append_
entry
(
self
,
entry
):
if
entry
.
is_pyglobal
and
not
entry
.
is_pyclass_attr
:
self
.
qualified_name
=
[
entry
.
name
]
else
:
entry
=
self
.
current_env
().
lookup_here
(
name
)
if
entry
.
is_pyglobal
and
not
entry
.
is_pyclass_attr
:
self
.
qualified_name
=
[
name
]
else
:
self
.
qualified_name
.
append
(
name
)
self
.
qualified_name
.
append
(
entry
.
name
)
def
visit_ClassNode
(
self
,
node
):
return
self
.
_set_qualname
(
node
,
node
.
name
)
def
visit_PyClassNamespaceNode
(
self
,
node
):
# class name was already added by parent node
return
self
.
_set_qualname
(
node
)
def
visit_PyCFunctionNode
(
self
,
node
):
...
...
@@ -1863,16 +1862,21 @@ class CalculateQualifiedNamesTransform(EnvTransform):
def
visit_FuncDefNode
(
self
,
node
):
orig_qualified_name
=
self
.
qualified_name
[:]
self
.
_append_name
(
node
.
name
)
if
getattr
(
node
,
'name'
,
None
)
==
'<lambda>'
:
self
.
qualified_name
.
append
(
'<lambda>'
)
else
:
self
.
_append_entry
(
node
.
entry
)
self
.
qualified_name
.
append
(
'<locals>'
)
self
.
_super
.
visit_FuncDefNode
(
node
)
self
.
_super
_
visit_FuncDefNode
(
node
)
self
.
qualified_name
=
orig_qualified_name
return
node
def
visit_ClassDefNode
(
self
,
node
):
orig_qualified_name
=
self
.
qualified_name
[:]
self
.
_append_name
(
node
.
name
)
self
.
_super
.
visit_ClassDefNode
(
node
)
entry
=
(
getattr
(
node
,
'entry'
,
None
)
or
# PyClass
self
.
current_env
().
lookup_here
(
node
.
name
))
# CClass
self
.
_append_entry
(
entry
)
self
.
_super_visit_ClassDefNode
(
node
)
self
.
qualified_name
=
orig_qualified_name
return
node
...
...
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