Skip to content

InterpreterPoolExecutor Hangs on Certain Functions #125864

@paultiq

Description

@paultiq

Bug report

Bug description:

** I first noticed this when testing the backports ericsnowcurrently/interpreters#17 on 3.13 on windows and WSL. Issue reproduced on 3.14.0a1+ 34653bb

The following code hangs:

from concurrent.futures.interpreter import InterpreterPoolExecutor

def my_func():
    return 1+2

with InterpreterPoolExecutor() as executor:
    future = executor.submit(my_func)
    
result = future.result()  # Get the result of the function
print(result)

Yet, if my_func is defined in another module (or imported, or a builtin), it works fine.

from concurrent.futures.interpreter import InterpreterPoolExecutor

with InterpreterPoolExecutor() as executor:
    future = executor.submit(print, "foo")
    
result = future.result()  # Get the result of the function
print(result)

EDIT: Also hangs if my_func is in another module that imports modules that dont support sub-ints.

Importing a module with the following will also hang:

import numpy 

def my_func(x):
    print(f"{x=}")

Note

** test_interpreter_pool imports all the used functions, such as mul, which won't reproduce this error.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytopic-subinterpreterstype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions