| 
56 | 56 |     "run_with_tz", "PGO", "missing_compiler_executable",  | 
57 | 57 |     "ALWAYS_EQ", "NEVER_EQ", "LARGEST", "SMALLEST",  | 
58 | 58 |     "LOOPBACK_TIMEOUT", "INTERNET_TIMEOUT", "SHORT_TIMEOUT", "LONG_TIMEOUT",  | 
59 |  | -    "Py_DEBUG", "EXCEEDS_RECURSION_LIMIT", "Py_C_RECURSION_LIMIT",  | 
 | 59 | +    "Py_DEBUG", "exceeds_recursion_limit", "get_c_recursion_limit",  | 
60 | 60 |     "skip_on_s390x",  | 
61 | 61 |     "without_optimizer",  | 
62 | 62 |     ]  | 
@@ -2490,22 +2490,18 @@ def adjust_int_max_str_digits(max_digits):  | 
2490 | 2490 |         sys.set_int_max_str_digits(current)  | 
2491 | 2491 | 
 
  | 
2492 | 2492 | 
 
  | 
2493 |  | -def _get_c_recursion_limit():  | 
 | 2493 | +def get_c_recursion_limit():  | 
2494 | 2494 |     try:  | 
2495 | 2495 |         import _testcapi  | 
2496 | 2496 |         return _testcapi.Py_C_RECURSION_LIMIT  | 
2497 |  | -    except (ImportError, AttributeError):  | 
2498 |  | -        # Originally taken from Include/cpython/pystate.h .  | 
2499 |  | -        if sys.platform == 'win32':  | 
2500 |  | -            return 4000  | 
2501 |  | -        else:  | 
2502 |  | -            return 10000  | 
 | 2497 | +    except ImportError:  | 
 | 2498 | +        raise unittest.SkipTest('requires _testcapi')  | 
 | 2499 | + | 
2503 | 2500 | 
 
  | 
2504 |  | -# The default C recursion limit.  | 
2505 |  | -Py_C_RECURSION_LIMIT = _get_c_recursion_limit()  | 
 | 2501 | +def exceeds_recursion_limit():  | 
 | 2502 | +    """For recursion tests, easily exceeds default recursion limit."""  | 
 | 2503 | +    return get_c_recursion_limit() * 3  | 
2506 | 2504 | 
 
  | 
2507 |  | -#For recursion tests, easily exceeds default recursion limit  | 
2508 |  | -EXCEEDS_RECURSION_LIMIT = Py_C_RECURSION_LIMIT * 3  | 
2509 | 2505 | 
 
  | 
2510 | 2506 | #Windows doesn't have os.uname() but it doesn't support s390x.  | 
2511 | 2507 | skip_on_s390x = unittest.skipIf(hasattr(os, 'uname') and os.uname().machine == 's390x',  | 
 | 
0 commit comments