This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Turtledemo: stop reloading demos
Type: behavior Stage: resolved
Components: Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: gregorlingl, python-dev, terry.reedy
Priority: normal Keywords: patch

Created on 2014-07-23 19:57 by terry.reedy, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg223771 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-07-23 19:57
I propose to remove the following two lines with 'reload' from turtledemo.__main__.py.

from importlib import reload
...
... def loadfile(self, filename):
...
        reload(self.module)

Reloading modules each time a demo is run allows and even encourages module level code that initializes variables (other than classes) and has system side-effects. In particular, some such calls created the test problems reported in #21882. Code that needs to be run each time the required main() is called should be inside main.  Indeed, reforming the two_canvases demo (see patch for #21882) made two_canvases work properly within the demo driver.

With the demos patched, I tried them all twice after commenting out the reload. I did not notice any difference, except possibly faster response.

I already edited the help text to tell users to initialize in main().
msg226335 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-09-03 23:29
New changeset b76d854f580e by Terry Jan Reedy in branch '2.7':
Issue #22051: remove unneeded reload that allowed bad code.
http://hg.python.org/cpython/rev/b76d854f580e

New changeset 55d4f6c2be2d by Terry Jan Reedy in branch '3.4':
Issue #22051: remove unneeded reload that allowed bad code.
http://hg.python.org/cpython/rev/55d4f6c2be2d
History
Date User Action Args
2022-04-11 14:58:06adminsetgithub: 66250
2018-06-29 03:46:27terry.reedysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2014-09-03 23:29:57python-devsetnosy: + python-dev
messages: + msg226335
2014-07-23 20:11:55terry.reedylinkissue14117 dependencies
2014-07-23 19:57:46terry.reedycreate