Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7e9b9ab

Browse files
Move the interpreters module to the official stdlib.
1 parentfe95f3f commit7e9b9ab

20 files changed

+47
-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
fromtest.supportimportimport_helper,skip_if_sanitizer
1010

1111
_channels=import_helper.import_module('_interpchannels')
12-
fromtest.support.interpretersimport_crossinterp
12+
frominterpretersimport_crossinterp
1313
fromtest.test__interpretersimport (
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
fromconcurrent.futures.interpreterimport (
99
ExecutionFailed,BrokenInterpreterPool,
1010
)
11+
frominterpretersimportqueues
1112
import_interpreters
1213
fromtestimportsupport
1314
importtest.test_asyncio.utilsastestasyncio_utils
14-
fromtest.support.interpretersimportqueues
1515

1616
from .executorimportExecutorTest,mul
1717
from .utilimportBaseTestCase,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
fromtest.supportimportimport_helper
1414
# Raise SkipTest if subinterpreters not supported.
1515
_interpreters=import_helper.import_module('_interpreters')
16+
importinterpreters
1617
fromtest.supportimportPy_GIL_DISABLED
17-
fromtest.supportimportinterpreters
1818
fromtest.supportimportforce_not_colorized
1919
importtest._crossinterp_definitionsasdefs
20-
fromtest.support.interpretersimport (
20+
frominterpretersimport (
2121
InterpreterError,InterpreterNotFoundError,ExecutionFailed,
2222
)
2323
from .utilsimport (
@@ -103,7 +103,7 @@ def test_in_subinterpreter(self):
103103
main,=interpreters.list_all()
104104
interp=interpreters.create()
105105
out=_run_output(interp,dedent("""
106-
from test.supportimport interpreters
106+
import interpreters
107107
interp = interpreters.create()
108108
print(interp.id)
109109
"""))
@@ -166,7 +166,7 @@ def test_subinterpreter(self):
166166
main=interpreters.get_main()
167167
interp=interpreters.create()
168168
out=_run_output(interp,dedent("""
169-
from test.supportimport interpreters
169+
import interpreters
170170
cur = interpreters.get_current()
171171
print(cur.id)
172172
"""))
@@ -183,7 +183,7 @@ def test_idempotent(self):
183183
withself.subTest('subinterpreter'):
184184
interp=interpreters.create()
185185
out=_run_output(interp,dedent("""
186-
from test.supportimport interpreters
186+
import interpreters
187187
cur = interpreters.get_current()
188188
print(id(cur))
189189
cur = interpreters.get_current()
@@ -195,7 +195,7 @@ def test_idempotent(self):
195195
withself.subTest('per-interpreter'):
196196
interp=interpreters.create()
197197
out=_run_output(interp,dedent("""
198-
from test.supportimport interpreters
198+
import interpreters
199199
cur = interpreters.get_current()
200200
print(id(cur))
201201
"""))
@@ -552,7 +552,7 @@ def test_from_current(self):
552552
main,=interpreters.list_all()
553553
interp=interpreters.create()
554554
out=_run_output(interp,dedent(f"""
555-
from test.supportimport interpreters
555+
import interpreters
556556
interp = interpreters.Interpreter({interp.id})
557557
try:
558558
interp.close()
@@ -569,7 +569,7 @@ def test_from_sibling(self):
569569
self.assertEqual(set(interpreters.list_all()),
570570
{main,interp1,interp2})
571571
interp1.exec(dedent(f"""
572-
from test.supportimport interpreters
572+
import interpreters
573573
interp2 = interpreters.Interpreter({interp2.id})
574574
interp2.close()
575575
interp3 = interpreters.create()
@@ -776,7 +776,7 @@ def eggs():
776776
ham()
777777
""")
778778
scriptfile=self.make_script('script.py',tempdir,text="""
779-
from test.supportimport interpreters
779+
import interpreters
780780
781781
def script():
782782
import spam
@@ -797,7 +797,7 @@ def script():
797797
~~~~~~~~~~~^^^^^^^^
798798
{interpmod_line.strip()}
799799
raise ExecutionFailed(excinfo)
800-
test.support.interpreters.ExecutionFailed: RuntimeError: uh-oh!
800+
interpreters.ExecutionFailed: RuntimeError: uh-oh!
801801
802802
Uncaught in the interpreter:
803803
@@ -1251,7 +1251,7 @@ def run(text):
12511251
# no module indirection
12521252
withself.subTest('no indirection'):
12531253
text=run(f"""
1254-
from test.supportimport interpreters
1254+
import interpreters
12551255
12561256
def spam():
12571257
# This a global var...
@@ -1271,7 +1271,7 @@ def run(interp, func):
12711271
""")
12721272
withself.subTest('indirect as func, direct interp'):
12731273
text=run(f"""
1274-
from test.supportimport interpreters
1274+
import interpreters
12751275
import mymod
12761276
12771277
def spam():
@@ -1287,7 +1287,7 @@ def spam():
12871287

12881288
# indirect as func, indirect interp
12891289
new_mod('mymod',f"""
1290-
from test.supportimport interpreters
1290+
import interpreters
12911291
def run(func):
12921292
interp = interpreters.create()
12931293
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
fromtest.supportimportimport_helper
99
# Raise SkipTest if subinterpreters not supported.
1010
_channels=import_helper.import_module('_interpchannels')
11-
fromtest.supportimportinterpreters
12-
fromtest.support.interpretersimportchannels
11+
importinterpreters
12+
frominterpretersimportchannels
1313
from .utilsimport_run_output,TestBase
1414

1515

@@ -171,7 +171,7 @@ def test_send_recv_main(self):
171171
deftest_send_recv_same_interpreter(self):
172172
interp=interpreters.create()
173173
interp.exec(dedent("""
174-
fromtest.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
deftest_send_recv_nowait_same_interpreter(self):
245245
interp=interpreters.create()
246246
interp.exec(dedent("""
247-
fromtest.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-
fromtest.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-
fromtest.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-
fromtest.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-
fromtest.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.supportimport 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
importsubprocess
172172
argv= [sys.executable,'-c','''if True:
173-
from test.supportimport interpreters
173+
import interpreters
174174
interp = interpreters.create()
175175
raise Exception
176176
''']

‎Lib/test/test_interpreters/test_queues.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
fromtest.supportimportimport_helper,Py_DEBUG
88
# Raise SkipTest if subinterpreters not supported.
99
_queues=import_helper.import_module('_interpqueues')
10-
fromtest.supportimportinterpreters
11-
fromtest.support.interpretersimportqueues,_crossinterp
10+
importinterpreters
11+
frominterpretersimportqueues,_crossinterp
1212
from .utilsimport_run_output,TestBaseas_TestBase
1313

1414

@@ -126,7 +126,7 @@ def test_shareable(self):
126126

127127
interp=interpreters.create()
128128
interp.exec(dedent(f"""
129-
fromtest.support.interpreters import queues
129+
from interpreters import queues
130130
queue1 = queues.Queue({queue1.id})
131131
"""));
132132

@@ -324,7 +324,7 @@ def test_put_get_full_fallback(self):
324324
deftest_put_get_same_interpreter(self):
325325
interp=interpreters.create()
326326
interp.exec(dedent("""
327-
fromtest.support.interpreters import queues
327+
from interpreters import queues
328328
queue = queues.create()
329329
"""))
330330
formethnamein ('get','get_nowait'):
@@ -351,7 +351,7 @@ def test_put_get_different_interpreters(self):
351351
out=_run_output(
352352
interp,
353353
dedent(f"""
354-
fromtest.support.interpreters import queues
354+
from interpreters import queues
355355
queue1 = queues.Queue({queue1.id})
356356
queue2 = queues.Queue({queue2.id})
357357
assert queue1.qsize() == 1, 'expected: queue1.qsize() == 1'
@@ -390,7 +390,7 @@ def common(queue, unbound=None, presize=0):
390390
interp=interpreters.create()
391391

392392
_run_output(interp,dedent(f"""
393-
fromtest.support.interpreters import queues
393+
from interpreters import queues
394394
queue = queues.Queue({queue.id})
395395
obj1 = b'spam'
396396
obj2 = b'eggs'
@@ -468,7 +468,7 @@ def test_put_cleared_with_subinterpreter_mixed(self):
468468
queue=queues.create()
469469
interp=interpreters.create()
470470
_run_output(interp,dedent(f"""
471-
fromtest.support.interpreters import queues
471+
from interpreters import queues
472472
queue = queues.Queue({queue.id})
473473
queue.put(1, unbounditems=queues.UNBOUND)
474474
queue.put(2, unbounditems=queues.UNBOUND_ERROR)
@@ -504,14 +504,14 @@ def test_put_cleared_with_subinterpreter_multiple(self):
504504

505505
queue.put(1)
506506
_run_output(interp1,dedent(f"""
507-
fromtest.support.interpreters import queues
507+
from interpreters import queues
508508
queue = queues.Queue({queue.id})
509509
obj1 = queue.get()
510510
queue.put(2, unbounditems=queues.UNBOUND)
511511
queue.put(obj1, unbounditems=queues.UNBOUND_REMOVE)
512512
"""))
513513
_run_output(interp2,dedent(f"""
514-
fromtest.support.interpreters import queues
514+
from interpreters import queues
515515
queue = queues.Queue({queue.id})
516516
obj2 = queue.get()
517517
obj1 = queue.get()

‎Lib/test/test_interpreters/test_stress.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
fromtest.supportimportthreading_helper
77
# Raise SkipTest if subinterpreters not supported.
88
import_helper.import_module('_interpreters')
9-
fromtest.supportimportinterpreters
9+
importinterpreters
1010
from .utilsimportTestBase
1111

1212

‎Lib/test/test_interpreters/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import_interpreters
2222
exceptImportErrorasexc:
2323
raiseunittest.SkipTest(str(exc))
24-
fromtest.supportimportinterpreters
24+
importinterpreters
2525

2626

2727
try:

‎Lib/test/test_sys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
fromtest.supportimportforce_not_colorized
2525
fromtest.supportimportSHORT_TIMEOUT
2626
try:
27-
fromtest.supportimportinterpreters
27+
importinterpreters
2828
exceptImportError:
2929
interpreters=None
3030
importtextwrap

‎Lib/test/test_threading.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
fromtestimportsupport
2929

3030
try:
31-
fromtest.supportimportinterpreters
31+
importinterpreters
3232
exceptImportError:
3333
interpreters=None
3434

‎Lib/test/test_types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2513,10 +2513,10 @@ class SubinterpreterTests(unittest.TestCase):
25132513
defsetUpClass(cls):
25142514
globalinterpreters
25152515
try:
2516-
fromtest.supportimportinterpreters
2516+
importinterpreters
25172517
exceptModuleNotFoundError:
25182518
raiseunittest.SkipTest('subinterpreters required')
2519-
importtest.support.interpreters.channels# noqa: F401
2519+
importinterpreters.channels# noqa: F401
25202520

25212521
@cpython_only
25222522
@no_rerun('channels (and queues) might have a refleak; see gh-122199')
@@ -2547,7 +2547,7 @@ def collate_results(raw):
25472547
main_results=collate_results(raw)
25482548

25492549
interp=interpreters.create()
2550-
interp.exec('from test.supportimport interpreters')
2550+
interp.exec('import interpreters')
25512551
interp.prepare_main(sch=sch)
25522552
interp.exec(script)
25532553
raw=rch.recv_nowait()

‎Makefile.pre.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2573,7 +2573,6 @@ TESTSUBDIRS=idlelib/idle_test \
25732573
test/subprocessdata \
25742574
test/support \
25752575
test/support/_hypothesis_stubs \
2576-
test/support/interpreters \
25772576
test/test_asyncio \
25782577
test/test_capi \
25792578
test/test_cext \

‎Modules/_interpchannelsmodule.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2744,11 +2744,7 @@ _get_current_channelend_type(int end)
27442744
// Force the module to be loaded, to register the type.
27452745
PyObject*highlevel=PyImport_ImportModule("interpreters.channels");
27462746
if (highlevel==NULL) {
2747-
PyErr_Clear();
2748-
highlevel=PyImport_ImportModule("test.support.interpreters.channels");
2749-
if (highlevel==NULL) {
2750-
returnNULL;
2751-
}
2747+
returnNULL;
27522748
}
27532749
Py_DECREF(highlevel);
27542750
if (end==CHANNEL_SEND) {

‎Modules/_interpqueuesmodule.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,7 @@ ensure_highlevel_module_loaded(void)
138138
{
139139
PyObject*highlevel=PyImport_ImportModule("interpreters.queues");
140140
if (highlevel==NULL) {
141-
PyErr_Clear();
142-
highlevel=PyImport_ImportModule("test.support.interpreters.queues");
143-
if (highlevel==NULL) {
144-
return-1;
145-
}
141+
return-1;
146142
}
147143
Py_DECREF(highlevel);
148144
return0;
@@ -299,7 +295,7 @@ add_QueueError(PyObject *mod)
299295
{
300296
module_state*state=get_module_state(mod);
301297

302-
#definePREFIX "test.support.interpreters."
298+
#definePREFIX "interpreters."
303299
#defineADD_EXCTYPE(NAME,BASE,DOC) \
304300
assert(state->NAME == NULL); \
305301
if (add_exctype(mod, &state->NAME, PREFIX #NAME, DOC, BASE) < 0) { \

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp