[Python-checkins] python/dist/src/Lib/test test_profile.py, 1.4, 1.4.4.1

arigo@users.sourceforge.net arigo at users.sourceforge.net
Tue Sep 20 22:53:28 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23392/test

Modified Files:
      Tag: release24-maint
	test_profile.py 
Log Message:
(backport) test and fix for buggy handling of exceptions raised by C
functions, causing the profiler to crash on an AssertionError if the same
Python function catches multiple exceptions from C functions.


Index: test_profile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_profile.py,v
retrieving revision 1.4
retrieving revision 1.4.4.1
diff -u -d -r1.4 -r1.4.4.1
--- test_profile.py	8 Jul 2004 04:22:19 -0000	1.4
+++ test_profile.py	20 Sep 2005 20:53:24 -0000	1.4.4.1
@@ -10,7 +10,7 @@
 # included in the profile and would appear to consume all the time.)
 ticks = 0
 
-def test_main():
+def test_1():
     global ticks
     ticks = 0
     prof = profile.Profile(timer)
@@ -95,6 +95,25 @@
     vereq (x, 1)
     os.unlink (TESTFN)
 
+def test_3():
+    result = []
+    def testfunc1():
+        try: len(None)
+        except: pass
+        try: len(None)
+        except: pass
+        result.append(True)
+    def testfunc2():
+        testfunc1()
+        testfunc1()
+    profile.runctx("testfunc2()", locals(), locals(), TESTFN)
+    vereq(result, [True, True])
+    os.unlink(TESTFN)
+
+def test_main():
+    test_1()
+    test_2()
+    test_3()
+
 if __name__ == "__main__":
     test_main()
-    test_2()



More information about the Python-checkins mailing list