diff options
author | Sam Gross <colesbury@gmail.com> | 2024-10-24 22:09:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-24 22:09:59 (GMT) |
commit | 332356b880576a1a00b5dc34f03d7d3995dd4512 (patch) | |
tree | 1f29a5ca46bb083c99e9d623f2da14a0f523014c /Lib/test/support | |
parent | 1306f33c84b2745aa8af5e3e8f680aa80b836c0e (diff) | |
download | cpython-332356b880576a1a00b5dc34f03d7d3995dd4512.zip cpython-332356b880576a1a00b5dc34f03d7d3995dd4512.tar.gz cpython-332356b880576a1a00b5dc34f03d7d3995dd4512.tar.bz2 |
gh-125900: Clean-up logic around immortalization in free-threading (#125901)
* Remove `@suppress_immortalization` decorator
* Make suppression flag per-thread instead of per-interpreter
* Suppress immortalization in `eval()` to avoid refleaks in three tests
(test_datetime.test_roundtrip, test_logging.test_config8_ok, and
test_random.test_after_fork).
* frozenset() is constant, but not a singleton. When run multiple times,
the test could fail due to constant interning.
Diffstat (limited to 'Lib/test/support')
-rw-r--r-- | Lib/test/support/__init__.py | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index f05be2b..ff917c9 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -512,33 +512,6 @@ def has_no_debug_ranges(): def requires_debug_ranges(reason='requires co_positions / debug_ranges'): return unittest.skipIf(has_no_debug_ranges(), reason) -@contextlib.contextmanager -def suppress_immortalization(suppress=True): - """Suppress immortalization of deferred objects.""" - try: - import _testinternalcapi - except ImportError: - yield - return - - if not suppress: - yield - return - - _testinternalcapi.suppress_immortalization(True) - try: - yield - finally: - _testinternalcapi.suppress_immortalization(False) - -def skip_if_suppress_immortalization(): - try: - import _testinternalcapi - except ImportError: - return - return unittest.skipUnless(_testinternalcapi.get_immortalize_deferred(), - "requires immortalization of deferred objects") - MS_WINDOWS = (sys.platform == 'win32') |