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
tkFont.__eq__ gives type error #45027
Comments
The current definition is: def __eq__(self, other):
return self.name == other.name and isinstance(other, Font) This can get an AttributeError if other isn't a Font. The code should be: def __eq__(self, other):
return isinstance(other, Font) and self.name == other.name |
Patch added |
I agree that this change is sensible and verified that it is needed for 3.1 as well. I think it should be applied. |
I think this one line patch still needs applying. |
Fixed in r84865. |
The new test case fails on (FreeBSD, OS X) buildbots: ====================================================================== Traceback (most recent call last):
File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/tkinter/test/test_tkinter/test_font.py", line 10, in test_font_eq
font1 = font.nametofont("system")
File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/tkinter/font.py", line 22, in nametofont
return Font(name=name, exists=True)
File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/tkinter/font.py", line 83, in __init__
"named font %s does not already exist" % (self.name,))
_tkinter.TclError: named font system does not already exist |
Closing this again in favor of bpo-9899. |
The patch was not committed to 2.7 and now this bug causes an error on buildbot. http://buildbot.python.org/all/builders/AMD64%20Debian%20root%202.7/builds/303/steps/test/logs/stdio ====================================================================== Traceback (most recent call last):
File "/root/buildarea/2.7.angelico-debian-amd64/build/Lib/test/test_gc.py", line 149, in test_finalizer
gc.garbage.remove(obj)
File "/root/buildarea/2.7.angelico-debian-amd64/build/Lib/lib-tk/tkFont.py", line 100, in __eq__
return self.name == other.name and isinstance(other, Font)
AttributeError: A instance has no attribute 'name' |
New changeset 841cdb6145e9 by Serhiy Storchaka in branch '2.7': |
New changeset 2b379c092253 by Ned Deily in branch '2.7': |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: