Skip to content

Commit df88c8d

Browse files
interpreters -> concurrent.interpreters
1 parent fb3e215 commit df88c8d

24 files changed

+46
-42
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,13 +281,13 @@ Doc/howto/clinic.rst @erlend-aasland
281281
# Subinterpreters
282282
**/*interpreteridobject.* @ericsnowcurrently
283283
**/*crossinterp* @ericsnowcurrently
284-
Lib/interpreters/ @ericsnowcurrently
285284
Modules/_interp*module.c @ericsnowcurrently
286-
Lib/test/test_interpreters/ @ericsnowcurrently
287285
Lib/test/test__interp*.py @ericsnowcurrently
286+
Lib/concurrent/interpreters/ @ericsnowcurrently
288287
Lib/test/support/channels.py @ericsnowcurrently
288+
Doc/library/concurrent.interpreters.rst @ericsnowcurrently
289+
Lib/test/test_interpreters/ @ericsnowcurrently
289290
Lib/concurrent/futures/interpreter.py @ericsnowcurrently
290-
Doc/library/interpreters.rst @ericsnowcurrently
291291

292292
# Android
293293
**/*Android* @mhsmith @freakboy3742

Doc/library/concurrency.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ multitasking). Here's an overview:
1818
multiprocessing.shared_memory.rst
1919
concurrent.rst
2020
concurrent.futures.rst
21+
concurrent.interpreters.rst
2122
subprocess.rst
2223
sched.rst
2324
queue.rst
2425
contextvars.rst
2526

26-
Also see the :mod:`interpreters` module.
27-
2827

2928
The following are support modules for some of the above services:
3029

Doc/library/interpreters.rst renamed to Doc/library/concurrent.interpreters.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
:mod:`!interpreters` --- Multiple Interpreters in the Same Process
2-
==================================================================
1+
:mod:`concurrent.!interpreters` --- Multiple Interpreters in the Same Process
2+
=============================================================================
33

4-
.. module:: interpreters
4+
.. module:: concurrent.interpreters
55
:synopsis: Multiple Interpreters in the Same Process
66

77
.. moduleauthor:: Eric Snow <ericsnowcurrently@gmail.com>
88
.. sectionauthor:: Eric Snow <ericsnowcurrently@gmail.com>
99

1010
.. versionadded:: 3.14
1111

12-
**Source code:** :source:`Lib/interpreters/__init__.py`
12+
**Source code:** :source:`Lib/concurrent/interpreters.py`
1313

1414
--------------
1515

1616

1717
Introduction
1818
------------
1919

20-
The :mod:`!interpreters` module constructs higher-level interfaces
21-
on top of the lower level :mod:`!_interpreters` module.
20+
The :mod:`!concurrent.interpreters` module constructs higher-level
21+
interfaces on top of the lower level :mod:`!_interpreters` module.
2222

2323
.. XXX Add references to the upcoming HOWTO docs in the seealso block.
2424
@@ -167,7 +167,7 @@ Basic Usage
167167

168168
Creating an interpreter and running code in it::
169169

170-
import interpreters
170+
from concurrent import interpreters
171171

172172
interp = interpreters.create()
173173

Doc/library/concurrent.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
The :mod:`!concurrent` package
22
==============================
33

4-
Currently, there is only one module in this package:
4+
Currently, there are only two modules in this package:
55

66
* :mod:`concurrent.futures` -- Launching parallel tasks
7+
* :mod:`concurrent.interpreters` -- Multiple interpreters in the same process

Doc/library/python.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ overview:
1717
builtins.rst
1818
__main__.rst
1919
warnings.rst
20-
interpreters.rst
2120
dataclasses.rst
2221
contextlib.rst
2322
abc.rst
@@ -28,3 +27,8 @@ overview:
2827
inspect.rst
2928
annotationlib.rst
3029
site.rst
30+
31+
.. seealso::
32+
33+
* See the :mod:`concurrent.interpreters` module, which similarly
34+
exposes core runtime functionality.

Doc/whatsnew/3.14.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Each of these separate copies is called an "interpreter".
135135
However, the feature has been available only through the C-API.
136136

137137
That limitation is removed in the 3.14 release,
138-
with the new :mod:`interpreters` module!
138+
with the new :mod:`concurrent.interpreters` module!
139139

140140
There are at least two notable reasons why using multiple interpreters
141141
is worth considering:
File renamed without changes.

Lib/test/support/channels.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
import time
44
import _interpchannels as _channels
5-
from interpreters import _crossinterp
5+
from concurrent.interpreters import _crossinterp
66

77
# aliases:
88
from _interpchannels import (
99
ChannelError, ChannelNotFoundError, ChannelClosedError, # noqa: F401
1010
ChannelEmptyError, ChannelNotEmptyError, # noqa: F401
1111
)
12-
from interpreters._crossinterp import (
12+
from concurrent.interpreters._crossinterp import (
1313
UNBOUND_ERROR, UNBOUND_REMOVE,
1414
)
1515

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 interpreters import _crossinterp
12+
from concurrent.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,7 +8,7 @@
88
from concurrent.futures.interpreter import (
99
ExecutionFailed, BrokenInterpreterPool,
1010
)
11-
from interpreters import _queues as queues
11+
from concurrent.interpreters import _queues as queues
1212
import _interpreters
1313
from test import support
1414
import test.test_asyncio.utils as testasyncio_utils

Lib/test/test_interpreters/test_channels.py

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

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-
import interpreters
122+
from concurrent 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-
import interpreters
173+
from concurrent 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
from test.support import import_helper, Py_DEBUG
88
# Raise SkipTest if subinterpreters not supported.
99
_queues = import_helper.import_module('_interpqueues')
10-
import interpreters
11-
from interpreters import _queues as queues, _crossinterp
10+
from concurrent import interpreters
11+
from concurrent.interpreters import _queues as queues, _crossinterp
1212
from .utils import _run_output, TestBase as _TestBase
1313

1414

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

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

@@ -324,7 +324,7 @@ def test_put_get_full_fallback(self):
324324
def test_put_get_same_interpreter(self):
325325
interp = interpreters.create()
326326
interp.exec(dedent("""
327-
from interpreters import _queues as queues
327+
from concurrent.interpreters import _queues as queues
328328
queue = queues.create()
329329
"""))
330330
for methname in ('get', 'get_nowait'):
@@ -351,7 +351,7 @@ def test_put_get_different_interpreters(self):
351351
out = _run_output(
352352
interp,
353353
dedent(f"""
354-
from interpreters import _queues as queues
354+
from concurrent.interpreters import _queues as 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-
from interpreters import _queues as queues
393+
from concurrent.interpreters import _queues as 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-
from interpreters import _queues as queues
471+
from concurrent.interpreters import _queues as 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-
from interpreters import _queues as queues
507+
from concurrent.interpreters import _queues as 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-
from interpreters import _queues as queues
514+
from concurrent.interpreters import _queues as 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
from test.support import threading_helper
77
# Raise SkipTest if subinterpreters not supported.
88
import_helper.import_module('_interpreters')
9-
import interpreters
9+
from concurrent import interpreters
1010
from .utils import TestBase
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
except ImportError as exc:
2323
raise unittest.SkipTest(str(exc))
24-
import interpreters
24+
from concurrent import interpreters
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
from test.support import force_not_colorized
2525
from test.support import SHORT_TIMEOUT
2626
try:
27-
import interpreters
27+
from concurrent import interpreters
2828
except ImportError:
2929
interpreters = None
3030
import textwrap

Lib/test/test_threading.py

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

3030
try:
31-
import interpreters
31+
from concurrent import interpreters
3232
except ImportError:
3333
interpreters = None
3434

Lib/test/test_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2513,7 +2513,7 @@ class SubinterpreterTests(unittest.TestCase):
25132513
def setUpClass(cls):
25142514
global interpreters
25152515
try:
2516-
import interpreters
2516+
from concurrent import interpreters
25172517
except ModuleNotFoundError:
25182518
raise unittest.SkipTest('subinterpreters required')
25192519
from test.support import channels # noqa: F401
@@ -2548,7 +2548,7 @@ def collate_results(raw):
25482548
main_results = collate_results(raw)
25492549

25502550
interp = interpreters.create()
2551-
interp.exec('import interpreters')
2551+
interp.exec('from concurrent import interpreters')
25522552
interp.prepare_main(sch=sch)
25532553
interp.exec(script)
25542554
raw = rch.recv_nowait()

Makefile.pre.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2514,7 +2514,7 @@ XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
25142514
LIBSUBDIRS= asyncio \
25152515
collections \
25162516
compression compression/_common compression/zstd \
2517-
concurrent concurrent/futures \
2517+
concurrent concurrent/futures concurrent/interpreters \
25182518
csv \
25192519
ctypes ctypes/macholib \
25202520
curses \
@@ -2526,7 +2526,6 @@ LIBSUBDIRS= asyncio \
25262526
http \
25272527
idlelib idlelib/Icons \
25282528
importlib importlib/resources importlib/metadata \
2529-
interpreters \
25302529
json \
25312530
logging \
25322531
multiprocessing multiprocessing/dummy \

Modules/_interpchannelsmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ wait_for_lock(PyThread_type_lock mutex, PY_TIMEOUT_T timeout)
223223
static int
224224
ensure_highlevel_module_loaded(void)
225225
{
226-
PyObject *highlevel = PyImport_ImportModule("interpreters.channels");
226+
PyObject *highlevel =
227+
PyImport_ImportModule("concurrent.interpreters._channels");
227228
if (highlevel == NULL) {
228229
PyErr_Clear();
229230
highlevel = PyImport_ImportModule("test.support.channels");

Modules/_interpqueuesmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ idarg_int64_converter(PyObject *arg, void *ptr)
136136
static int
137137
ensure_highlevel_module_loaded(void)
138138
{
139-
PyObject *highlevel = PyImport_ImportModule("interpreters._queues");
139+
PyObject *highlevel =
140+
PyImport_ImportModule("concurrent.interpreters._queues");
140141
if (highlevel == NULL) {
141142
return -1;
142143
}

Python/stdlib_module_names.h

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)