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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
3421e034
Commit
3421e034
authored
Nov 07, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix "__qualname__" of names defined as 'global'
parent
8524b21f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
8 deletions
+28
-8
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+7
-5
tests/run/cyfunction.pyx
tests/run/cyfunction.pyx
+21
-3
No files found.
Cython/Compiler/ExprNodes.py
View file @
3421e034
...
...
@@ -6679,6 +6679,8 @@ class ModuleNameMixin(object):
def
set_qualified_name
(
self
,
env
,
self_name
):
self
.
module_name
=
env
.
global_scope
().
qualified_name
qualified_name
=
[
self_name
]
entry
=
env
.
lookup
(
self_name
)
if
not
entry
or
not
(
entry
.
is_pyglobal
and
not
entry
.
is_pyclass_attr
):
while
env
and
not
env
.
is_module_scope
:
if
env
.
is_closure_scope
:
qualified_name
.
append
(
'<locals>'
)
...
...
tests/run/cyfunction.pyx
View file @
3421e034
...
...
@@ -47,24 +47,42 @@ def test_qualname():
def
test_nested_qualname
():
"""
>>> func, lambda_func = test_nested_qualname()
>>> func, lambda_func
, XYZ
= test_nested_qualname()
>>> func().__qualname__
'test_nested_qualname.<locals>.outer.<locals>.Test'
>>> func().test.__qualname__
'test_nested_qualname.<locals>.outer.<locals>.Test.test'
>>> func()().__qualname__
'test_nested_qualname.<locals>.outer.<locals>.Test'
>>> func()().test.__qualname__
'test_nested_qualname.<locals>.outer.<locals>.Test.test'
>>> func()().test().__qualname__
'XYZinner'
>>> func()().test()().__qualname__
'XYZinner'
>>> lambda_func.__qualname__
'test_nested_qualname.<locals>.<lambda>'
>>> XYZ.__qualname__
'XYZ'
"""
def
outer
():
class
Test
(
object
):
def
test
(
self
):
return
123
global
XYZinner
class
XYZinner
(
object
):
pass
return
XYZinner
return
Test
return
outer
,
lambda
:
None
global
XYZ
class
XYZ
(
object
):
pass
return
outer
,
lambda
:
None
,
XYZ
def
test_doc
():
...
...
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