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

tkFont.__eq__ gives type error #45027

Closed
lpd mannequin opened this issue Jun 3, 2007 · 10 comments
Closed

tkFont.__eq__ gives type error #45027

lpd mannequin opened this issue Jun 3, 2007 · 10 comments
Assignees
Labels
topic-tkinter type-bug An unexpected behavior, bug, or error

Comments

@lpd
Copy link
Mannequin

lpd mannequin commented Jun 3, 2007

BPO 1730136
Nosy @loewis, @terryjreedy, @amauryfa, @pitrou, @serhiy-storchaka
Files
  • tkFont.Font.eq.diff
  • 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/amauryfa'
    closed_at = <Date 2010-09-20.13:30:23.006>
    created_at = <Date 2007-06-03.05:20:25.000>
    labels = ['type-bug', 'expert-tkinter']
    title = 'tkFont.__eq__ gives type error'
    updated_at = <Date 2014-08-21.06:00:26.419>
    user = 'https://bugs.python.org/lpd'

    bugs.python.org fields:

    activity = <Date 2014-08-21.06:00:26.419>
    actor = 'python-dev'
    assignee = 'amaury.forgeotdarc'
    closed = True
    closed_date = <Date 2010-09-20.13:30:23.006>
    closer = 'gpolo'
    components = ['Tkinter']
    creation = <Date 2007-06-03.05:20:25.000>
    creator = 'lpd'
    dependencies = []
    files = ['10508']
    hgrepos = []
    issue_num = 1730136
    keywords = ['patch']
    message_count = 10.0
    messages = ['32193', '67661', '107429', '116683', '116738', '116919', '116931', '223839', '223844', '225598']
    nosy_count = 9.0
    nosy_names = ['loewis', 'terry.reedy', 'lpd', 'amaury.forgeotdarc', 'pitrou', 'gpolo', 'BreamoreBoy', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'commit review'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue1730136'
    versions = ['Python 3.1', 'Python 2.7', 'Python 3.2']

    @lpd
    Copy link
    Mannequin Author

    lpd mannequin commented Jun 3, 2007

    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

    @lpd lpd mannequin assigned loewis Jun 3, 2007
    @lpd lpd mannequin added the topic-tkinter label Jun 3, 2007
    @lpd lpd mannequin assigned loewis Jun 3, 2007
    @lpd lpd mannequin added the topic-tkinter label Jun 3, 2007
    @gpolo
    Copy link
    Mannequin

    gpolo mannequin commented Jun 3, 2008

    Patch added

    @terryjreedy
    Copy link
    Member

    I agree that this change is sensible and verified that it is needed for 3.1 as well. I think it should be applied.

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Sep 17, 2010

    I think this one line patch still needs applying.

    @BreamoreBoy BreamoreBoy mannequin added type-bug An unexpected behavior, bug, or error labels Sep 17, 2010
    @amauryfa
    Copy link
    Member

    Fixed in r84865.

    @pitrou
    Copy link
    Member

    pitrou commented Sep 20, 2010

    The new test case fails on (FreeBSD, OS X) buildbots:

    ======================================================================
    ERROR: test_font_eq (tkinter.test.test_tkinter.test_font.FontTest)
    ----------------------------------------------------------------------

    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

    @pitrou pitrou reopened this Sep 20, 2010
    @pitrou pitrou assigned amauryfa and unassigned loewis Sep 20, 2010
    @pitrou pitrou reopened this Sep 20, 2010
    @pitrou pitrou assigned amauryfa and unassigned loewis Sep 20, 2010
    @gpolo
    Copy link
    Mannequin

    gpolo mannequin commented Sep 20, 2010

    Closing this again in favor of bpo-9899.

    @gpolo gpolo mannequin closed this as completed Sep 20, 2010
    @gpolo gpolo mannequin closed this as completed Sep 20, 2010
    @serhiy-storchaka
    Copy link
    Member

    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

    ======================================================================
    ERROR: test_finalizer (test.test_gc.GCTests)
    ----------------------------------------------------------------------

    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'

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jul 24, 2014

    New changeset 841cdb6145e9 by Serhiy Storchaka in branch '2.7':
    Issue bpo-1730136: Fix comparison between a tk Font object and an object of a
    http://hg.python.org/cpython/rev/841cdb6145e9

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 21, 2014

    New changeset 2b379c092253 by Ned Deily in branch '2.7':
    Issue bpo-1730136: Fix backported exception name.
    http://hg.python.org/cpython/rev/2b379c092253

    @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
    topic-tkinter type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants