InterpreterPoolExecutor doesn't respect "thread_name_prefix"
Open
Nobody has claimed this yet.
3.14
extension-modules
topic-subinterpreters
type-bug
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Bug report
Bug description:
InterpreterPoolExecutor takes a thread_name_prefix parameter, but it doesn't propagate to the underlying subinterpreter.
from concurrent.futures import ThreadPoolExecutor
try:
from concurrent.futures.interpreter import InterpreterPoolExecutor # 3.14+
except ModuleNotFoundError:
from interpreters_backport.concurrent.futures.interpreter import InterpreterPoolExecutor
with ThreadPoolExecutor(thread_name_prefix="test_tpe") as tpe_executor:
tpe_executor.submit(exec, "import threading;print(threading.current_thread().name)") #
with InterpreterPoolExecutor(thread_name_prefix="test_ipe") as ipe_executor:
ipe_executor.submit(exec, "import threading;print(threading.current_thread().name)")
Produces
test_tpe_0
Dummy-1
CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with concurrent.futures.interpreter.InterpreterPoolExecutor and compare its thread_name_prefix behavior with concurrent.futures.ThreadPoolExecutor using the reproducer in the issue. Confirm that the interpreter worker reports a name using the requested prefix, and add or update coverage for the demonstrated output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100