diff options
author | Armin Rigo <arigo@tunes.org> | 2005-09-20 20:53:24 +0000 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2005-09-20 20:53:24 +0000 |
commit | bf8cef4fb938c9d8bfd7351cbc31f6c3c141ebe9 (patch) | |
tree | b9f77f684fed83778d283e8e1ce76fd3139250b8 /Lib/test | |
parent | (backport) tracing of C functions: don't call the trace func (diff) | |
download | cpython-bf8cef4fb938c9d8bfd7351cbc31f6c3c141ebe9.tar.gz cpython-bf8cef4fb938c9d8bfd7351cbc31f6c3c141ebe9.tar.bz2 cpython-bf8cef4fb938c9d8bfd7351cbc31f6c3c141ebe9.zip |
(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.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_profile.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/Lib/test/test_profile.py b/Lib/test/test_profile.py index e0bda5ccf0b..aa0f26cf2cc 100644 --- a/Lib/test/test_profile.py +++ b/Lib/test/test_profile.py @@ -10,7 +10,7 @@ from test.test_support import TESTFN, vereq # 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 @@ def test_2(): 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() |