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

name conflict in ScrolledCanvas.__init__() in Lib/turtle.py #48366

Closed
gregorlingl mannequin opened this issue Oct 13, 2008 · 4 comments
Closed

name conflict in ScrolledCanvas.__init__() in Lib/turtle.py #48366

gregorlingl mannequin opened this issue Oct 13, 2008 · 4 comments
Labels
stdlib Python modules in the Lib dir

Comments

@gregorlingl
Copy link
Mannequin

gregorlingl mannequin commented Oct 13, 2008

BPO 4116
Nosy @loewis
Files
  • ScrolledCanvas.init.diff: bugfix
  • 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 = None
    closed_at = <Date 2008-11-19.09:15:21.027>
    created_at = <Date 2008-10-13.22:57:07.267>
    labels = ['library']
    title = 'name conflict in ScrolledCanvas.__init__() in Lib/turtle.py'
    updated_at = <Date 2008-11-19.09:15:20.981>
    user = 'https://bugs.python.org/gregorlingl'

    bugs.python.org fields:

    activity = <Date 2008-11-19.09:15:20.981>
    actor = 'loewis'
    assignee = 'none'
    closed = True
    closed_date = <Date 2008-11-19.09:15:21.027>
    closer = 'loewis'
    components = ['Library (Lib)']
    creation = <Date 2008-10-13.22:57:07.267>
    creator = 'gregorlingl'
    dependencies = []
    files = ['11776']
    hgrepos = []
    issue_num = 4116
    keywords = ['patch']
    message_count = 4.0
    messages = ['74709', '74720', '76021', '76042']
    nosy_count = 2.0
    nosy_names = ['loewis', 'gregorlingl']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue4116'
    versions = ['Python 2.6', 'Python 3.0']

    @gregorlingl
    Copy link
    Mannequin Author

    gregorlingl mannequin commented Oct 13, 2008

    In ScrolledCanvas.__init__() there's a name conflict with a methodname
    of the parentclass Frame: _root. The bugfix consists in renaming this
    attribute, which occurs only twice. No change in behaviour at all.

    Regards,
    Gregor

    @gregorlingl gregorlingl mannequin added the stdlib Python modules in the Lib dir label Oct 13, 2008
    @gregorlingl
    Copy link
    Mannequin Author

    gregorlingl mannequin commented Oct 14, 2008

    This patch applies to Python 2.6 as well
    Gregor

    @gregorlingl
    Copy link
    Mannequin Author

    gregorlingl mannequin commented Nov 18, 2008

    I'd like to see this patch accepted and done for Python 2.6.1 and (at
    the same time) python 3.0 before the last rc is released. So could you
    dedicate a few minutes to reviewing it.

    To demonstrate the nature of this issue (and also the nuisance it could
    produce) I've constructed a minimal example to show the consequences of
    the bug:

    import turtle
    
    s = turtle.Screen()
    
    def changecolor():
        s.bgcolor(1.0, 0.5)  # needs 3 floats as arguments
    
    s.ontimer(changecolor, 1000)
    turtle.mainloop()

    This should create an error message like this:
    ....
    TurtleGraphicsError: bad color arguments: (100, 100)

    Instead it results in:

    Traceback (most recent call last):
      File "C:\_\provoke_error.py", line 11, in <module>
        turtle.mainloop()
      File "C:\Python26\lib\lib-tk\Tkinter.py", line 325, in mainloop
        _default_root.tk.mainloop(n)
      File "C:\Python26\lib\lib-tk\Tkinter.py", line 1414, in __call__
        self.widget._report_exception()
      File "C:\Python26\lib\lib-tk\Tkinter.py", line 1175, in _report_exception
        root = self._root()
    AttributeError: _Root instance has no __call__ method

    because the _root() method defined in line 1105 of Tkinter.py is
    overwritten by the _root attribute of ScrolledCanvas (lines 362 and
    382). So in these (hopefully rare) cases where an error message is
    directly provoked from the Tkinter module, this will fail letting the
    user without clue about what happened.

    With the proposed patch applied, the above script produces the correct
    error message.

    Regards, Gregor

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Nov 19, 2008

    Thanks for the patch. Committed as r67279, r67280, and r67281.

    @loewis loewis mannequin closed this as completed Nov 19, 2008
    @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
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    0 participants