Stéphane Blondon <[email protected]> added the comment:
I think an asdict() method is not necessary. Instanciating a dict from
os.environ is enough:
>>> import os
>>> os.environ
environ({'SHELL': '/bin/bash', ...})
>>> dict(os.environ)
{'SHELL': '/bin/bash', ...})
With 'dict()', it's obvious there is no side effect.
I think os._Environ should not be pickable too because there is an ambiguity
too when it will be unpicked: should we set the unpickled data to a basic dict
(or another _Environ instance) or to the environment variables?
It seems there are more maintainers in favour of the removal. Removing the copy
is a breaking change so it should be done on several releases.
Are you interested by a PR which adds DeprecationWarning when
copy.copy(os.environ) or os.environ.copy() are called? It seems to be the first
step to implement.
----------
nosy: +sblondon
versions: +Python 3.11 -Python 3.10
_______________________________________
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