Author: Armin Rigo <[email protected]>
Branch: py3.6
Changeset: r97380:95bc2c5d41f8
Date: 2019-09-05 16:19 +0200
http://bitbucket.org/pypy/pypy/changeset/95bc2c5d41f8/
Log: hg merge default
diff --git a/pypy/module/pypyjit/test_pypy_c/test_getframe.py
b/pypy/module/pypyjit/test_pypy_c/test_getframe.py
--- a/pypy/module/pypyjit/test_pypy_c/test_getframe.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_getframe.py
@@ -23,3 +23,45 @@
--TICK--
jump(..., descr=...)
""")
+
+ def test_current_frames(self):
+ def main():
+ import sys
+ import time
+ import thread
+
+ lst = [0.0] * 1000
+ lst[-33] = 3.0
+ done = []
+
+ def h1(x):
+ time.sleep(lst[x])
+
+ def g1(x):
+ h1(x)
+
+ def f1():
+ for j in range(1000):
+ g1(j)
+ done.append('done')
+
+ for k in range(3):
+ thread.start_new_thread(f1, ())
+
+ time.sleep(1)
+ d = sys._current_frames()
+
+ time.sleep(3)
+ # the captured frames should be finished by now
+
+ done.append(str(len(d)))
+ for key, value in d.items():
+ while value is not None:
+ name = value.f_code.co_name
+ if len(name) == 2 and name[1] == '1':
+ done.append(name)
+ value = value.f_back
+ return repr('-'.join(done))
+
+ log = self.run(main, [])
+ assert log.result == 'done-done-done-4-h1-g1-f1-h1-g1-f1-h1-g1-f1'
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit