Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turtledemo: stop reloading demos #66250

Closed
terryjreedy opened this issue Jul 23, 2014 · 2 comments
Closed

Turtledemo: stop reloading demos #66250

terryjreedy opened this issue Jul 23, 2014 · 2 comments
Assignees
Labels
type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 22051
Nosy @terryjreedy

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/terryjreedy'
closed_at = <Date 2018-06-29.03:46:27.284>
created_at = <Date 2014-07-23.19:57:46.928>
labels = ['type-bug']
title = 'Turtledemo: stop reloading demos'
updated_at = <Date 2018-06-29.03:46:27.283>
user = 'https://github.com/terryjreedy'

bugs.python.org fields:

activity = <Date 2018-06-29.03:46:27.283>
actor = 'terry.reedy'
assignee = 'terry.reedy'
closed = True
closed_date = <Date 2018-06-29.03:46:27.284>
closer = 'terry.reedy'
components = []
creation = <Date 2014-07-23.19:57:46.928>
creator = 'terry.reedy'
dependencies = []
files = []
hgrepos = []
issue_num = 22051
keywords = ['patch']
message_count = 2.0
messages = ['223771', '226335']
nosy_count = 3.0
nosy_names = ['terry.reedy', 'gregorlingl', 'python-dev']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue22051'
versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

@terryjreedy
Copy link
Member Author

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 bpo-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 bpo-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().

@terryjreedy terryjreedy self-assigned this Jul 23, 2014
@terryjreedy terryjreedy added the type-bug An unexpected behavior, bug, or error label Jul 23, 2014
@python-dev
Copy link
Mannequin

python-dev mannequin commented Sep 3, 2014

New changeset b76d854f580e by Terry Jan Reedy in branch '2.7':
Issue bpo-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 bpo-22051: remove unneeded reload that allowed bad code.
http://hg.python.org/cpython/rev/55d4f6c2be2d

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant