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: name conflict in ScrolledCanvas.__init__() in Lib/turtle.py
Type: Stage:
Components: Library (Lib) Versions: Python 3.0, Python 2.6
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: gregorlingl, loewis
Priority: normal Keywords: patch

Created on 2008-10-13 22:57 by gregorlingl, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ScrolledCanvas.__init__.diff gregorlingl, 2008-10-13 22:57 bugfix
Messages (4)
msg74709 - (view) Author: Gregor Lingl (gregorlingl) Date: 2008-10-13 22:57
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
msg74720 - (view) Author: Gregor Lingl (gregorlingl) Date: 2008-10-14 04:52
This patch applies to Python 2.6 as well
Gregor
msg76021 - (view) Author: Gregor Lingl (gregorlingl) Date: 2008-11-18 22:17
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
msg76042 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-11-19 09:15
Thanks for the patch. Committed as r67279, r67280, and r67281.
History
Date User Action Args
2022-04-11 14:56:40adminsetgithub: 48366
2008-11-19 09:15:21loewissetstatus: open -> closed
resolution: accepted
messages: + msg76042
2008-11-18 22:17:04gregorlinglsetmessages: + msg76021
2008-10-14 04:52:06gregorlinglsetmessages: + msg74720
versions: + Python 2.6
2008-10-13 22:57:07gregorlinglcreate