huajun07 / codesketcher

Visualise your code in action!
https://main.d1fr5et3wgts3j.amplifyapp.com/
MIT License
0 stars 0 forks source link

Fix: Update arrays and dictionaries values when mutated #43

Closed limanjun99 closed 1 year ago

limanjun99 commented 1 year ago

This PR fixes this issue. The bug is in the executor service, where the previous variables were stored by reference. Hence, they got modified when the next line runs, and became equal to the current variables.

The fix is to deep copy (with copy.deepcopy) the variables, so that the stored previous variables do not change.

Tested locally on the frontend. Testcases for array and dict have been added to the executor service.

Screenshot 2023-06-18 at 7 02 54 PM

Screenshot 2023-06-18 at 7 03 21 PM