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
a55ce63c
Commit
a55ce63c
authored
Jan 25, 2012
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use whitelist for declaring entries in a scope
parent
d88146d0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
8 deletions
+16
-8
Cython/Compiler/CythonScope.py
Cython/Compiler/CythonScope.py
+3
-2
Cython/Compiler/MemoryView.py
Cython/Compiler/MemoryView.py
+3
-0
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+6
-4
Cython/Compiler/UtilityCode.py
Cython/Compiler/UtilityCode.py
+4
-2
No files found.
Cython/Compiler/CythonScope.py
View file @
a55ce63c
...
...
@@ -115,9 +115,10 @@ class CythonScope(ModuleScope):
viewscope
,
cython_scope
=
self
)
view_utility_scope
=
MemoryView
.
view_utility_code
.
declare_in_scope
(
self
.
viewscope
,
cython_scope
=
self
)
self
.
viewscope
,
cython_scope
=
self
,
whitelist
=
MemoryView
.
view_utility_whitelist
)
self
.
entries
[
"array"
]
=
view_utility_scope
.
looku
p
(
"array"
)
self
.
entries
[
"array"
]
=
view_utility_scope
.
entries
.
po
p
(
"array"
)
def
create_cython_scope
(
context
):
...
...
Cython/Compiler/MemoryView.py
View file @
a55ce63c
...
...
@@ -919,5 +919,8 @@ view_utility_code = load_memview_cy_utility(
overlapping_utility
,
copy_contents_new_utility
],
)
view_utility_whitelist
=
(
'array'
,
'memoryview'
,
'array_cwrapper'
,
'generic'
,
'strided'
,
'indirect'
,
'contiguous'
,
'indirect_contiguous'
)
copy_contents_new_utility
.
requires
.
append
(
view_utility_code
)
\ No newline at end of file
Cython/Compiler/Symtab.py
View file @
a55ce63c
...
...
@@ -290,11 +290,13 @@ class Scope(object):
def __deepcopy__(self, memo):
return self
def merge_in(self, other, merge_unused=True):
def merge_in(self, other, merge_unused=True
, whitelist=None
):
# Use with care...
entries = [(name, entry)
for name, entry in other.entries.iteritems()
if entry.used or merge_unused]
entries = []
for name, entry in other.entries.iteritems():
if not whitelist or name in whitelist:
if entry.used or merge_unused:
entries.append((name, entry))
self.entries.update(entries)
...
...
Cython/Compiler/UtilityCode.py
View file @
a55ce63c
...
...
@@ -138,7 +138,8 @@ class CythonUtilityCode(Code.UtilityCodeBase):
util
=
cls
.
load
(
util_code_name
,
from_file
,
**
kwargs
)
return
util
.
proto
,
util
.
impl
# keep line numbers => no lstrip()
def
declare_in_scope
(
self
,
dest_scope
,
used
=
False
,
cython_scope
=
None
):
def
declare_in_scope
(
self
,
dest_scope
,
used
=
False
,
cython_scope
=
None
,
whitelist
=
None
):
"""
Declare all entries from the utility code in dest_scope. Code will only
be included for used entries. If module_name is given, declare the
...
...
@@ -157,7 +158,8 @@ class CythonUtilityCode(Code.UtilityCodeBase):
entry
.
used
=
used
original_scope
=
tree
.
scope
dest_scope
.
merge_in
(
original_scope
,
merge_unused
=
True
)
dest_scope
.
merge_in
(
original_scope
,
merge_unused
=
True
,
whitelist
=
whitelist
)
tree
.
scope
=
dest_scope
for
dep
in
self
.
requires
:
...
...
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