AttributeError: 'Item' object has no attribute 'enum'

Bug #524259 reported by Markus Korn on 2010-02-19
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lazr.enum
Low
Ian Booth

Bug Description

I got this error when running lp:lazr.enum

>>> from enum import Item
>>> Item('a') == Item('b')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/TEST/lib/python2.6/site-packages/lazr.enum-1.1.2-py2.6.egg/lazr/enum/_enum.py", line 167, in __eq__
    self.enum == other.enum)
AttributeError: 'Item' object has no attribute 'enum'
>>>

Related branches

Tim Penhey (thumper) wrote :

Items only test equal if they belong to the same EnumeratedType.

I guess we could either raise a different error saying that the Item isn't part of an enumerated type, or we could just always say that they are not equal. I'm not sure I necessarily agree with either.

Robert Collins (lifeless) wrote :

__eq__ should not raise AttributeError if two things cannot be compared - TypeError is the exception to raise. (That or never be equal).

Changed in lazr.enum:
status: New → Triaged
importance: Undecided → Low
Ian Booth (wallyworld) on 2012-04-18
Changed in lazr.enum:
status: Triaged → In Progress
assignee: nobody → Ian Booth (wallyworld)
Ian Booth (wallyworld) on 2012-04-19
Changed in lazr.enum:
milestone: none → 1.1.4
Colin Watson (cjwatson) wrote :

Fixed in lazr.enum 1.1.4 (released on 2012-04-19).

Changed in lazr.enum:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers