Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.2k
Closed
Description
Bug report
After python3.11 changes around frozen imports, when using multiprocessing contexts other thanfork
, the newly added-Xfrozen_modules=off
isn't passed to spawned process interpreters.
Simple snippet demonstrating the issue:
"""$ python -Xfrozen_modules=off test.pymain: {'frozen_modules': 'off'}forkserver: {}spawn: {}fork: {'frozen_modules': 'off'}"""importsysimportmultiprocessingdefxoptions():returnsys._xoptionsdefmain():print('main:',xoptions())forctxin ('forkserver','spawn','fork'):withmultiprocessing.get_context(ctx).Pool(1)aspool:print(f'{ctx}:',pool.apply(xoptions))if__name__=='__main__':main()
The issue seems to besubprocess._args_from_interpreter_flags
not honoringfrozen_modules
key fromsys._xoptions
.
$ python -Xfrozen_modules=off -c'import subprocess;print(subprocess._args_from_interpreter_flags())'[]
Your environment
python 3.11.4