Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
6fecfd16
Commit
6fecfd16
authored
Mar 25, 2015
by
Travis Hance
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
address kmod's comments on static closures
parent
5082369a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
19 deletions
+19
-19
src/analysis/scoping_analysis.h
src/analysis/scoping_analysis.h
+2
-2
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+0
-1
test/tests/static_closure_locations.py
test/tests/static_closure_locations.py
+17
-16
No files found.
src/analysis/scoping_analysis.h
View file @
6fecfd16
...
...
@@ -98,8 +98,8 @@ public:
virtual
DerefInfo
getDerefInfo
(
InternedString
name
)
=
0
;
// Gets the DerefInfo for each DEREF variable accessible in the scope.
// The returned vector is in SORTED ORDER by the `num_parents_from_passed_closure` field
.
// This allows the caller to iterate through the vector while also walking up
// The returned vector is in SORTED ORDER by the `num_parents_from_passed_closure` field
//
(ascending).
This allows the caller to iterate through the vector while also walking up
// the closure chain to collect all the DEREF variable values. This is useful, for example,
// in the implementation of locals().
//
...
...
src/runtime/objmodel.cpp
View file @
6fecfd16
...
...
@@ -1277,7 +1277,6 @@ Box* getattrInternalGeneric(Box* obj, const std::string& attr, GetattrRewriteArg
*
bind_obj_out
=
NULL
;
}
// TODO this should be a custom getattr
assert
(
obj
->
cls
!=
closure_cls
);
// Handle descriptor logic here.
...
...
test/tests/static_closure_locations.py
View file @
6fecfd16
# should_error
# The use of c makes sure a closure gets passed through all 4 functions.
# The use of a in g makes sure that a is in f's closure.
# The a in j should refer to the a in h, thus throwing an exception since
# it is undefined (that is, it should *not* access the a from f even
# though it access via the closure).
def
f
():
try
:
def
f
():
c
=
0
a
=
0
def
g
():
...
...
@@ -22,4 +21,6 @@ def f():
a
=
1
h
()
g
()
f
()
f
()
except
NameError
as
ne
:
print
ne
.
message
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