Max Katsev <[email protected]> added the comment:
Note that deepcopy doesn't work either, even though it looks like it does at
the first glance (which is arguably worse since it's harder to notice):
Python 3.8.6 (default, Jun 4 2021, 05:16:01)
>>> import copy, os, subprocess
>>> env_copy = copy.deepcopy(os.environ)
>>> env_copy["TEST"] = "oh no"
>>> os.environ["TEST"]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/fbcode/platform009/lib/python3.8/os.py", line 675, in
__getitem__
raise KeyError(key) from None
KeyError: 'TEST'
>>> subprocess.run("echo $TEST", shell=True,
>>> capture_output=True).stdout.decode()
'oh no\n'
----------
nosy: +mkatsev
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue15373>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com