[issue38092] environment variables not passed correctly using new virtualenv launching in windows and python3.7+

Pierre Glaser report at bugs.python.org
Tue Sep 10 11:52:15 EDT 2019


Pierre Glaser <pierreglaser at msn.com> added the comment:

> Dropping this into Lib/multiprocessing/spawn.py should cause a repro:

  if WINSERVICE:
      _python_exe = os.path.join(sys.exec_prefix, 'python.exe')
  else:
      _python_exe = getattr(sys, '_base_executable', sys.executable)

In this case, spawn.get_executable() will return (sys._base_executable), and `env` will be set to None anyways no? (see these lines: https://github.com/python/cpython/blob/9008be303a89bfab8c3314c6a42330b5523adc8b/Lib/multiprocessing/popen_spawn_win32.py#L59-L68)

We need to trigger the if clause of these lines instead, which happens by default in a virtual env -- this is why it is so troubling: even though a very simple case (launching a new process from within a virtualenv) should trigger a bug, it does not.

> And maybe submit a PR with the fix?

Will do.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38092>
_______________________________________


More information about the Python-bugs-list mailing list