[PLW1507] Mark fix unsafe (#16343)

This commit is contained in:
Vasco Schiavo 2025-02-24 13:42:44 +01:00 committed by GitHub
parent 5bac4f6bd4
commit 42a5f5ef6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 37 additions and 2 deletions

View file

@ -2,3 +2,11 @@ import copy
import os
copied_env = copy.copy(os.environ) # [shallow-copy-environ]
# Test case where the proposed fix is wrong, i.e., unsafe fix
# Ref: https://github.com/astral-sh/ruff/issues/16274#event-16423475135
os.environ["X"] = "0"
env = copy.copy(os.environ)
os.environ["X"] = "1"