[Python-checkins] cpython (merge 3.2 -> 3.3): Merge #6717 crasher from 3.2

nick.coghlan python-checkins at python.org
Mon Nov 5 12:33:37 CET 2012


http://hg.python.org/cpython/rev/509f7a53f8cc
changeset:   80269:509f7a53f8cc
branch:      3.3
parent:      80266:e29b50e1e8e5
parent:      80268:0dfa3b09a6fe
user:        Nick Coghlan <ncoghlan at gmail.com>
date:        Mon Nov 05 21:32:11 2012 +1000
summary:
  Merge #6717 crasher from 3.2

files:
  Lib/test/crashers/trace_at_recursion_limit.py |  27 ++++++++++
  1 files changed, 27 insertions(+), 0 deletions(-)


diff --git a/Lib/test/crashers/trace_at_recursion_limit.py b/Lib/test/crashers/trace_at_recursion_limit.py
new file mode 100644
--- /dev/null
+++ b/Lib/test/crashers/trace_at_recursion_limit.py
@@ -0,0 +1,27 @@
+"""
+From http://bugs.python.org/issue6717
+
+A misbehaving trace hook can trigger a segfault by exceeding the recursion
+limit.
+"""
+import sys
+
+
+def x():
+    pass
+
+def g(*args):
+    if True: # change to True to crash interpreter
+        try:
+            x()
+        except:
+            pass
+    return g
+
+def f():
+    print(sys.getrecursionlimit())
+    f()
+
+sys.settrace(g)
+
+f()

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list