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
4e6bd9db
Commit
4e6bd9db
authored
Apr 29, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collect sys_getframe tests into a single file
parent
edcadddc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
54 deletions
+76
-54
test/tests/globals.py
test/tests/globals.py
+2
-0
test/tests/sys_getframe.py
test/tests/sys_getframe.py
+74
-0
test/tests/sys_getframe2.py
test/tests/sys_getframe2.py
+0
-17
test/tests/sys_getframe3.py
test/tests/sys_getframe3.py
+0
-22
test/tests/sys_getframe4.py
test/tests/sys_getframe4.py
+0
-15
No files found.
test/tests/globals.py
View file @
4e6bd9db
...
...
@@ -13,3 +13,5 @@ x = 2
z
=
2
True
=
"new_true"
f
()
assert
globals
()
is
globals
()
test/tests/sys_getframe
1
.py
→
test/tests/sys_getframe.py
View file @
4e6bd9db
...
...
@@ -11,7 +11,64 @@ def interpolate(templateStr):
t
=
Template
(
templateStr
)
return
t
.
substitute
(
**
framedict
)
name
=
'Feihong'
place
=
'Chicago'
print
interpolate
(
"My name is ${name}. I work in ${place}."
)
def
f1
():
def
sysframetest
():
return
sys
.
_getframe
(
0
)
def
sysframetestwrapper
():
return
sysframetest
()
fr
=
sysframetest
()
print
sysframetest
.
__name__
print
fr
.
f_code
.
co_name
print
fr
.
f_code
.
co_filename
fr
=
sysframetestwrapper
()
print
sysframetestwrapper
.
__name__
print
fr
.
f_code
.
co_name
print
fr
.
f_code
.
co_filename
f1
()
# Make sure we can throw exceptions through frame we called _getframe
def
f2
():
def
g
():
sys
.
_getframe
(
1
)
1
/
0
def
f
():
g
()
try
:
f
()
except
Exception
as
e
:
print
e
f2
()
def
f3
():
fr
=
sys
.
_getframe
(
0
)
print
fr
.
f_lineno
print
fr
.
f_lineno
print
sorted
(
fr
.
f_locals
.
keys
())
a
=
1
print
sorted
(
fr
.
f_locals
.
keys
())
f3
()
def
f4
():
f1
=
sys
.
_getframe
(
0
)
# trigger osr:
for
i
in
xrange
(
20000
):
pass
assert
f1
is
sys
.
_getframe
(
0
)
f4
()
assert
sys
.
_getframe
(
0
).
f_globals
is
globals
()
def
f5
():
assert
sys
.
_getframe
(
0
).
f_globals
is
globals
()
f5
()
test/tests/sys_getframe2.py
deleted
100644 → 0
View file @
edcadddc
import
sys
def
sysframetest
():
return
sys
.
_getframe
(
0
)
def
sysframetestwrapper
():
return
sysframetest
()
fr
=
sysframetest
()
print
sysframetest
.
__name__
print
fr
.
f_code
.
co_name
print
fr
.
f_code
.
co_filename
fr
=
sysframetestwrapper
()
print
sysframetestwrapper
.
__name__
print
fr
.
f_code
.
co_name
print
fr
.
f_code
.
co_filename
test/tests/sys_getframe3.py
deleted
100644 → 0
View file @
edcadddc
import
sys
def
f
():
fr
=
sys
.
_getframe
(
0
)
print
fr
.
f_lineno
print
fr
.
f_lineno
print
sorted
(
fr
.
f_locals
.
keys
())
a
=
1
print
sorted
(
fr
.
f_locals
.
keys
())
f
()
assert
sys
.
_getframe
(
0
)
is
sys
.
_getframe
(
0
)
def
f2
():
f1
=
sys
.
_getframe
(
0
)
# trigger osr:
for
i
in
xrange
(
20000
):
pass
assert
f1
is
sys
.
_getframe
(
0
)
f2
()
test/tests/sys_getframe4.py
deleted
100644 → 0
View file @
edcadddc
# Make sure we can throw exceptions through frame we called _getframe
import
sys
def
g
():
sys
.
_getframe
(
1
)
1
/
0
def
f
():
g
()
try
:
f
()
except
Exception
as
e
:
print
e
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