.. _shallow-copy-environ:

shallow-copy-environ / W1507
============================

**Message emitted:**

Using copy.copy(os.environ). Use os.environ.copy() instead. 

**Description:**

*os.environ is not a dict object but proxy object, so shallow copy has still effects on original object. See https://bugs.python.org/issue15373 for reference.*

**Problematic code:**

.. literalinclude:: /data/messages/s/shallow-copy-environ/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/s/shallow-copy-environ/good.py
   :language: python



Created by the `stdlib <https://github.com/PyCQA/pylint/blob/main/pylint/checkers/stdlib.py>`__ checker.