Skip to content

Turtledemo: stop reloading demos #66250

Closed

Description

@terryjreedy
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']

Activity

  1. terryjreedy commented on Jul 23, 2014

    @terryjreedy
    MemberAuthor

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

  2. self-assigned this
    on Jul 23, 2014
  3. python-dev commented on Sep 3, 2014

    python-devmannequin
    Mannequin

    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

  4. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions