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
Hide 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:
...
@@ -98,8 +98,8 @@ public:
virtual
DerefInfo
getDerefInfo
(
InternedString
name
)
=
0
;
virtual
DerefInfo
getDerefInfo
(
InternedString
name
)
=
0
;
// Gets the DerefInfo for each DEREF variable accessible in the scope.
// 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
.
// 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
//
(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,
// the closure chain to collect all the DEREF variable values. This is useful, for example,
// in the implementation of locals().
// 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
...
@@ -1277,7 +1277,6 @@ Box* getattrInternalGeneric(Box* obj, const std::string& attr, GetattrRewriteArg
*
bind_obj_out
=
NULL
;
*
bind_obj_out
=
NULL
;
}
}
// TODO this should be a custom getattr
assert
(
obj
->
cls
!=
closure_cls
);
assert
(
obj
->
cls
!=
closure_cls
);
// Handle descriptor logic here.
// 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 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 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
# 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
# it is undefined (that is, it should *not* access the a from f even
# though it access via the closure).
# though it access via the closure).
def
f
():
try
:
c
=
0
def
f
():
a
=
0
c
=
0
def
g
():
a
=
0
print
c
def
g
():
print
a
def
h
():
print
c
print
c
def
j
():
print
a
def
h
():
print
c
print
c
print
a
def
j
():
print
c
print
a
j
()
j
()
a
=
1
a
=
1
h
()
h
()
g
()
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