diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-02-20 17:47:40 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-02-20 17:47:40 -0500 |
commit | 22de85832e877b5b360eeacd4b71e00f69bf00e1 (patch) | |
tree | 5ffe76d475a0fab2349def56f7a42b5a414f2679 /cmd2 | |
parent | a2061ba7ce9e8482111d670e78fe890cf485b7c5 (diff) | |
download | cmd2-git-22de85832e877b5b360eeacd4b71e00f69bf00e1.tar.gz |
Updated comment
Diffstat (limited to 'cmd2')
-rw-r--r-- | cmd2/cmd2.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 26031538..b314a683 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -3121,8 +3121,9 @@ class Cmd(cmd.Cmd): self._in_py = True py_code_to_run = '' - # Use self.py_locals as the locals() dictionary in the Python environment we are creating, but make - # a copy to prevent pyscripts from editing it. (e.g. locals().clear()). Only make a shallow copy since + # Make a copy of self.py_locals for the locals dictionary in the Python environment we are creating. + # This is to prevent pyscripts from editing it. (e.g. locals().clear()). It also ensures a pyscript's + # environment won't be filled with data from a previously run pyscript. Only make a shallow copy since # it's OK for py_locals to contain objects which are editable in a pyscript. localvars = dict(self.py_locals) localvars[self.py_bridge_name] = py_bridge |