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

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


http://hg.python.org/cpython/rev/47943fe516ec
changeset:   80270:47943fe516ec
parent:      80267:c4b5dfcb4a01
parent:      80269:509f7a53f8cc
user:        Nick Coghlan <ncoghlan at gmail.com>
date:        Mon Nov 05 21:33:22 2012 +1000
summary:
  Merge #6717 crasher from 3.3

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