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
2a360337
Commit
2a360337
authored
Dec 06, 2016
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure scopes of var_entries are recorded.
This fixes #1540.
parent
905a14ba
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
1 deletion
+14
-1
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+3
-1
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+3
-0
tests/run/static_methods.pyx
tests/run/static_methods.pyx
+8
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
2a360337
...
...
@@ -6376,7 +6376,8 @@ class AttributeNode(ExprNode):
# as an ordinary function.
if
entry
.
func_cname
and
not
hasattr
(
entry
.
type
,
'op_arg_struct'
):
cname
=
entry
.
func_cname
if
entry
.
type
.
is_static_method
or
env
.
parent_scope
.
is_cpp_class_scope
:
if
entry
.
type
.
is_static_method
or
(
env
.
parent_scope
and
env
.
parent_scope
.
is_cpp_class_scope
):
ctype
=
entry
.
type
elif
type
.
is_cpp_class
:
error
(
self
.
pos
,
"%s not a static member of %s"
%
(
entry
.
name
,
type
))
...
...
@@ -6393,6 +6394,7 @@ class AttributeNode(ExprNode):
ubcm_entry
.
is_cfunction
=
1
ubcm_entry
.
func_cname
=
entry
.
func_cname
ubcm_entry
.
is_unbound_cmethod
=
1
ubcm_entry
.
scope
=
entry
.
scope
return
self
.
as_name_node
(
env
,
ubcm_entry
,
target
=
False
)
elif
type
.
is_enum
:
if
self
.
attribute
in
type
.
values
:
...
...
Cython/Compiler/Symtab.py
View file @
2a360337
...
...
@@ -981,6 +981,7 @@ class BuiltinScope(Scope):
var_entry
.
is_readonly
=
1
var_entry
.
is_builtin
=
1
var_entry
.
utility_code
=
utility_code
var_entry
.
scope
=
self
if
Options
.
cache_builtins
:
var_entry
.
is_const
=
True
entry
.
as_variable
=
var_entry
...
...
@@ -1580,6 +1581,7 @@ class ModuleScope(Scope):
var_entry
.
is_variable
=
1
var_entry
.
is_cglobal
=
1
var_entry
.
is_readonly
=
1
var_entry
.
scope
=
entry
.
scope
entry
.
as_variable
=
var_entry
def
is_cpp
(
self
):
...
...
@@ -2122,6 +2124,7 @@ class CClassScope(ClassScope):
var_entry
.
is_variable
=
1
var_entry
.
is_builtin
=
1
var_entry
.
utility_code
=
utility_code
var_entry
.
scope
=
entry
.
scope
entry
.
as_variable
=
var_entry
return
entry
...
...
tests/run/static_methods.pyx
View file @
2a360337
...
...
@@ -59,6 +59,13 @@ def call_static_cdef2(int x, int y):
"""
return
A
.
static_cdef2
(
&
x
,
&
y
)
def
call_static_list_comprehension_GH1540
(
int
x
):
"""
>>> call_static_list_comprehension_GH1540(5)
[('cdef', 5), ('cdef', 5), ('cdef', 5)]
"""
return
[
A
.
static_cdef
(
&
x
)
for
_
in
range
(
3
)]
# BROKEN
#def call_static_cdef_untyped(a, b):
# """
...
...
@@ -67,6 +74,7 @@ def call_static_cdef2(int x, int y):
# """
# return A.static_cdef_untyped(a, b)
# UNIMPLEMENTED
# def call_static_cpdef(int x):
# """
# >>> call_static_cpdef(2)
...
...
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