InterpreterPoolExecutor workers do not inherit modifications made to sys.path before starting. #126714
Labels
3.14
new features, bugs and security fixes
stdlib
Python modules in the Lib dir
topic-subinterpreters
type-bug
An unexpected behavior, bug, or error
Bug report
Bug description:
All existing executors will reflect modifications to
sys.path
in the child thread/process/whatever that gets started. However the newInterpreterPoolExecutor
is not copying this behavior, leading to unexpected import errors when for example running sub-intepreters inside of pytest, as the test directory is added to thesys.path
in the parent interpreter but will be lost in the sub-interpreter.This is easily worked around by using an initializer:
This behavior makes sense for sub-interpreters themselves, but probably not for the
InterpreterPoolExecutor
.cc. @ericsnowcurrently
CPython versions tested on:
3.13, 3.14
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered: