Message334656
> Because sometimes when a process is implicitly started by some 3rd
> party library (i.e. COM via pythonwin here) the "old", unchanged
> environment is retained as the process itself doesn't care if
> os.environ was changed or not, the original environment cannot
> be modified.
What "old" environment are we talking about? The os.environ mapping is implemented to immediately modify the process environment block. For example:
Python:
>>> os.environ['SPAM'] = 'EGGS'
Debugger:
Breakpoint 0 hit
KERNELBASE!SetEnvironmentVariableW:
00007fff`8ae3ee30 4053 push rbx
0:000> kc 6
Call Site
KERNELBASE!SetEnvironmentVariableW
ucrtbase!common_set_variable_in_environment_nolock<wchar_t>
ucrtbase!common_putenv_nolock<wchar_t>
ucrtbase!common_putenv<wchar_t>
python37!os_putenv_impl
python37!os_putenv
0:000> du @rcx
00000215`70dd57c0 "SPAM"
0:000> du @rdx
00000215`70dd57ca "EGGS" |
|
Date |
User |
Action |
Args |
2019-02-01 08:42:46 | eryksun | set | recipients:
+ eryksun, paul.moore, tim.golden, zach.ware, steve.dower, josh.r, roufique7, r-or |
2019-02-01 08:42:44 | eryksun | set | messageid: <1549010564.82.0.103961572056.issue35862@roundup.psfhosted.org> |
2019-02-01 08:42:44 | eryksun | link | issue35862 messages |
2019-02-01 08:42:44 | eryksun | create | |
|