Skip to content

Commit c0e665b

Browse files
Avoid importing test.support.os_helper in legacy interpreters.
1 parent 0786736 commit c0e665b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Lib/test/test_interpreters/utils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717
import warnings
1818

1919
from test import support
20-
from test.support import os_helper
21-
from test.support import import_helper
2220

23-
_interpreters = import_helper.import_module('_xxsubinterpreters')
21+
# We would use test.support.import_helper.import_module(),
22+
# but the indirect import of test.support.os_helper causes refleaks.
23+
try:
24+
import _xxsubinterpreters as _interpreters
25+
except ImportError as exc:
26+
raise unittest.SkipTest(str(exc))
2427
from test.support import interpreters
2528

2629

@@ -399,6 +402,7 @@ def ensure_closed(fd):
399402
def temp_dir(self):
400403
tempdir = tempfile.mkdtemp()
401404
tempdir = os.path.realpath(tempdir)
405+
from test.support import os_helper
402406
self.addCleanup(lambda: os_helper.rmtree(tempdir))
403407
return tempdir
404408

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy