Account for the scope when changing variables #1869
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this issue:
#1857
The user is trying to assign the global 'c' to a new value while inside of a function. Since the variable is listed under 'globals', you'd think this would just work.
Internally we don't actually assign it to globals unless the user types
globals()['c']=value
, but that doesn't really make sense from the variables panel.I found that the scope of the variable is passed in the
setVariables
request, so we can use that to determine if the variable was originally a global or not and assign it to the correct scope.I tested this with Pydevd's test automation and by using VS code.
Addresses #1857