Skip to content

Commit

Permalink
Accept duplicates in env if they map to the same value. Fixes #607
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed May 31, 2021
1 parent ab4b969 commit 7774109
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/debugpy/launcher/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,16 @@ def property_or_debug_option(prop_name, flag_name):
# overwrite the global env vars correctly. If debug config has entries that
# differ in case only, that's an error.
env = {k.upper(): v for k, v in os.environ.items()}
n = len(env_changes)
env_changes = {k.upper(): v for k, v in env_changes.items()}
if len(env_changes) != n:
raise request.isnt_valid('Duplicate entries in "env"')
new_env_changes = {}
for k, v in env_changes.items():
k_upper = k.upper()
if k_upper in new_env_changes:
if new_env_changes[k_upper] == v:
continue
else:
raise request.isnt_valid('Found duplicate in "env": {0}.'.format(k_upper))
new_env_changes[k_upper] = v
env_changes = new_env_changes
if "DEBUGPY_TEST" in env:
# If we're running as part of a debugpy test, make sure that codecov is not
# applied to the debuggee, since it will conflict with pydevd.
Expand Down

0 comments on commit 7774109

Please sign in to comment.