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
198f254f
Commit
198f254f
authored
Aug 23, 2012
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always try global scope on class scope lookup failure
parent
38945955
Changes
2
Hide 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
+6
-8
tests/run/pyclass_scope_T671.py
tests/run/pyclass_scope_T671.py
+22
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
198f254f
...
...
@@ -1670,17 +1670,15 @@ class NameNode(AtomicExprNode):
self
.
result
(),
namespace
,
interned_cname
))
if
self
.
cf_maybe_null
:
if
not
self
.
cf_is_null
:
code
.
putln
(
'if (unlikely(!%s)) {'
%
self
.
result
())
code
.
putln
(
'PyErr_Clear();'
)
code
.
putln
(
'%s = __Pyx_GetName(%s, %s);'
%
(
code
.
putln
(
'if (unlikely(!%s)) {'
%
self
.
result
())
code
.
putln
(
'PyErr_Clear();'
)
code
.
putln
(
'%s = __Pyx_GetName(%s, %s);'
%
(
self
.
result
(),
Naming
.
module_cname
,
interned_cname
))
if
not
self
.
cf_is_null
:
code
.
putln
(
"}"
);
if
not
self
.
cf_is_null
:
code
.
putln
(
"}"
);
code
.
putln
(
code
.
error_goto_if_null
(
self
.
result
(),
self
.
pos
))
code
.
put_gotref
(
self
.
py_result
())
...
...
tests/run/pyclass_scope_T671.py
View file @
198f254f
...
...
@@ -78,3 +78,25 @@ def name_error_deleted():
"""
class
X
(
object
):
C
=
C
_set
=
set
def
name_lookup_order
():
"""
>>> Scope = name_lookup_order()
>>> Scope().set(2)
42
>>> Scope.test1 == _set()
True
>>> Scope.test2 == _set()
True
"""
class
Scope
(
object
):
test1
=
set
()
test2
=
set
()
def
set
(
self
,
x
):
return
42
return
Scope
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