Skip to content

Commit ea9041c

Browse files
Move the interpreters module to the official stdlib.
1 parent 52deabe commit ea9041c

21 files changed

+49
-56
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ Doc/howto/clinic.rst @erlend-aasland
281281
# Subinterpreters
282282
**/*interpreteridobject.* @ericsnowcurrently
283283
**/*crossinterp* @ericsnowcurrently
284-
Lib/test/support/interpreters/ @ericsnowcurrently
284+
Lib/interpreters/ @ericsnowcurrently
285285
Modules/_interp*module.c @ericsnowcurrently
286286
Lib/test/test_interpreters/ @ericsnowcurrently
287287

File renamed without changes.

Lib/test/test__interpchannels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from test.support import import_helper, skip_if_sanitizer
1010

1111
_channels = import_helper.import_module('_interpchannels')
12-
from test.support.interpreters import _crossinterp
12+
from interpreters import _crossinterp
1313
from test.test__interpreters import (
1414
_interpreters,
1515
_run_output,

Lib/test/test_concurrent_futures/test_interpreter_pool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
from concurrent.futures.interpreter import (
99
ExecutionFailed, BrokenInterpreterPool,
1010
)
11+
from interpreters import queues
1112
import _interpreters
1213
from test import support
1314
import test.test_asyncio.utils as testasyncio_utils
14-
from test.support.interpreters import queues
1515

1616
from .executor import ExecutorTest, mul
1717
from .util import BaseTestCase, InterpreterPoolMixin, setup_module

Lib/test/test_interpreters/test_api.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
from test.support import import_helper
1414
# Raise SkipTest if subinterpreters not supported.
1515
_interpreters = import_helper.import_module('_interpreters')
16+
import interpreters
1617
from test.support import Py_GIL_DISABLED
17-
from test.support import interpreters
1818
from test.support import force_not_colorized
1919
import test._crossinterp_definitions as defs
20-
from test.support.interpreters import (
20+
from interpreters import (
2121
InterpreterError, InterpreterNotFoundError, ExecutionFailed,
2222
)
2323
from .utils import (
@@ -133,7 +133,7 @@ def test_in_subinterpreter(self):
133133
main, = interpreters.list_all()
134134
interp = interpreters.create()
135135
out = _run_output(interp, dedent("""
136-
from test.support import interpreters
136+
import interpreters
137137
interp = interpreters.create()
138138
print(interp.id)
139139
"""))
@@ -196,7 +196,7 @@ def test_subinterpreter(self):
196196
main = interpreters.get_main()
197197
interp = interpreters.create()
198198
out = _run_output(interp, dedent("""
199-
from test.support import interpreters
199+
import interpreters
200200
cur = interpreters.get_current()
201201
print(cur.id)
202202
"""))
@@ -213,7 +213,7 @@ def test_idempotent(self):
213213
with self.subTest('subinterpreter'):
214214
interp = interpreters.create()
215215
out = _run_output(interp, dedent("""
216-
from test.support import interpreters
216+
import interpreters
217217
cur = interpreters.get_current()
218218
print(id(cur))
219219
cur = interpreters.get_current()
@@ -225,7 +225,7 @@ def test_idempotent(self):
225225
with self.subTest('per-interpreter'):
226226
interp = interpreters.create()
227227
out = _run_output(interp, dedent("""
228-
from test.support import interpreters
228+
import interpreters
229229
cur = interpreters.get_current()
230230
print(id(cur))
231231
"""))
@@ -582,7 +582,7 @@ def test_from_current(self):
582582
main, = interpreters.list_all()
583583
interp = interpreters.create()
584584
out = _run_output(interp, dedent(f"""
585-
from test.support import interpreters
585+
import interpreters
586586
interp = interpreters.Interpreter({interp.id})
587587
try:
588588
interp.close()
@@ -599,7 +599,7 @@ def test_from_sibling(self):
599599
self.assertEqual(set(interpreters.list_all()),
600600
{main, interp1, interp2})
601601
interp1.exec(dedent(f"""
602-
from test.support import interpreters
602+
import interpreters
603603
interp2 = interpreters.Interpreter({interp2.id})
604604
interp2.close()
605605
interp3 = interpreters.create()
@@ -806,7 +806,7 @@ def eggs():
806806
ham()
807807
""")
808808
scriptfile = self.make_script('script.py', tempdir, text="""
809-
from test.support import interpreters
809+
import interpreters
810810
811811
def script():
812812
import spam
@@ -827,7 +827,7 @@ def script():
827827
~~~~~~~~~~~^^^^^^^^
828828
{interpmod_line.strip()}
829829
raise ExecutionFailed(excinfo)
830-
test.support.interpreters.ExecutionFailed: RuntimeError: uh-oh!
830+
interpreters.ExecutionFailed: RuntimeError: uh-oh!
831831
832832
Uncaught in the interpreter:
833833
@@ -1281,7 +1281,7 @@ def run(text):
12811281
# no module indirection
12821282
with self.subTest('no indirection'):
12831283
text = run(f"""
1284-
from test.support import interpreters
1284+
import interpreters
12851285
12861286
def spam():
12871287
# This a global var...
@@ -1301,7 +1301,7 @@ def run(interp, func):
13011301
""")
13021302
with self.subTest('indirect as func, direct interp'):
13031303
text = run(f"""
1304-
from test.support import interpreters
1304+
import interpreters
13051305
import mymod
13061306
13071307
def spam():
@@ -1317,7 +1317,7 @@ def spam():
13171317

13181318
# indirect as func, indirect interp
13191319
new_mod('mymod', f"""
1320-
from test.support import interpreters
1320+
import interpreters
13211321
def run(func):
13221322
interp = interpreters.create()
13231323
return interp.call(func)

Lib/test/test_interpreters/test_channels.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from test.support import import_helper
99
# Raise SkipTest if subinterpreters not supported.
1010
_channels = import_helper.import_module('_interpchannels')
11-
from test.support import interpreters
12-
from test.support.interpreters import channels
11+
import interpreters
12+
from interpreters import channels
1313
from .utils import _run_output, TestBase
1414

1515

@@ -171,7 +171,7 @@ def test_send_recv_main(self):
171171
def test_send_recv_same_interpreter(self):
172172
interp = interpreters.create()
173173
interp.exec(dedent("""
174-
from test.support.interpreters import channels
174+
from interpreters import channels
175175
r, s = channels.create()
176176
orig = b'spam'
177177
s.send_nowait(orig)
@@ -244,7 +244,7 @@ def test_send_recv_nowait_main_with_default(self):
244244
def test_send_recv_nowait_same_interpreter(self):
245245
interp = interpreters.create()
246246
interp.exec(dedent("""
247-
from test.support.interpreters import channels
247+
from interpreters import channels
248248
r, s = channels.create()
249249
orig = b'spam'
250250
s.send_nowait(orig)
@@ -387,7 +387,7 @@ def common(rch, sch, unbound=None, presize=0):
387387
interp = interpreters.create()
388388

389389
_run_output(interp, dedent(f"""
390-
from test.support.interpreters import channels
390+
from interpreters import channels
391391
sch = channels.SendChannel({sch.id})
392392
obj1 = b'spam'
393393
obj2 = b'eggs'
@@ -482,7 +482,7 @@ def test_send_cleared_with_subinterpreter_mixed(self):
482482
self.assertEqual(_channels.get_count(rch.id), 0)
483483

484484
_run_output(interp, dedent(f"""
485-
from test.support.interpreters import channels
485+
from interpreters import channels
486486
sch = channels.SendChannel({sch.id})
487487
sch.send_nowait(1, unbounditems=channels.UNBOUND)
488488
sch.send_nowait(2, unbounditems=channels.UNBOUND_ERROR)
@@ -518,15 +518,15 @@ def test_send_cleared_with_subinterpreter_multiple(self):
518518

519519
sch.send_nowait(1)
520520
_run_output(interp1, dedent(f"""
521-
from test.support.interpreters import channels
521+
from interpreters import channels
522522
rch = channels.RecvChannel({rch.id})
523523
sch = channels.SendChannel({sch.id})
524524
obj1 = rch.recv()
525525
sch.send_nowait(2, unbounditems=channels.UNBOUND)
526526
sch.send_nowait(obj1, unbounditems=channels.UNBOUND_REMOVE)
527527
"""))
528528
_run_output(interp2, dedent(f"""
529-
from test.support.interpreters import channels
529+
from interpreters import channels
530530
rch = channels.RecvChannel({rch.id})
531531
sch = channels.SendChannel({sch.id})
532532
obj2 = rch.recv()

Lib/test/test_interpreters/test_lifecycle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def test_sys_path_0(self):
119119
# The main interpreter's sys.path[0] should be used by subinterpreters.
120120
script = '''
121121
import sys
122-
from test.support import interpreters
122+
import interpreters
123123
124124
orig = sys.path[0]
125125
@@ -170,7 +170,7 @@ def test_gh_109793(self):
170170
# is reported, even when subinterpreters get cleaned up at the end.
171171
import subprocess
172172
argv = [sys.executable, '-c', '''if True:
173-
from test.support import interpreters
173+
import interpreters
174174
interp = interpreters.create()
175175
raise Exception
176176
''']

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