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:

import copy
import os

copied_env = copy.copy(os.environ)  # [shallow-copy-environ]

Correct code:

import os

copied_env = os.environ.copy()

Created by the stdlib checker.