From 3f18f10f39a55963e63d544382f0e17668ed97e8 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 1 Oct 2015 08:55:33 +0200 Subject: [PATCH] Issue #25274: test_recursionlimit_recovery() of test_sys now checks sys.gettrace() when the test is executed, not when the module is loaded. sys.settrace() may be after after the test is loaded. --- Lib/test/test_sys.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index a6d926f7de..b7ddbe95cb 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -197,9 +197,10 @@ class SysModuleTest(unittest.TestCase): self.assertEqual(sys.getrecursionlimit(), 10000) sys.setrecursionlimit(oldlimit) - @unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(), - 'fatal error if run with a trace function') def test_recursionlimit_recovery(self): + if hasattr(sys, 'gettrace') and sys.gettrace(): + self.skipTest('fatal error if run with a trace function') + # NOTE: this test is slightly fragile in that it depends on the current # recursion count when executing the test being low enough so as to # trigger the recursion recovery detection in the _Py_MakeEndRecCheck -- 2.40.0