Author eli.bendersky
Recipients alex, barry, docs@python, eli.bendersky, ethan.furman, ezio.melotti, gvanrossum, ncoghlan, zach.ware
Date 2013-05-11.19:10:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1368299446.38.0.717430522814.issue17947@psf.upfronthosting.co.za>
In-reply-to
Content
Ethan, something is wrong with _StealthProperty. Well, two things. First, it's way too general and can be cut to just what Enum needs. Second, this is enough to make the tests pass:

class _StealthProperty():
    """
    Returns the value in the instance, or the virtual attribute on the class.

    A virtual attribute is one that is looked up by __getattr__, as opposed to
    one that lives in __class__.__dict__

    """

    def __init__(self, fget):
        self.fget = fget

    def __get__(self, obj, objtype=None):
        return self.fget(obj)

    def __set__(self, obj, value):
        raise AttributeError("can't set attribute")

    def __delete__(self, obj):
        raise AttributeError("can't delete attribute")

Now  this is fishy because __get__ gets obj=None when called on a class and therefore self.fget(obj) raises an exception. But this gets caught somewhere in your code or tests and ignored. However, the right thing is still returned. I didn't have more time to investigate, but this must be cleaned out.
History
Date User Action Args
2013-05-11 19:10:46eli.benderskysetrecipients: + eli.bendersky, gvanrossum, barry, ncoghlan, ezio.melotti, alex, docs@python, ethan.furman, zach.ware
2013-05-11 19:10:46eli.benderskysetmessageid: <1368299446.38.0.717430522814.issue17947@psf.upfronthosting.co.za>
2013-05-11 19:10:46eli.benderskylinkissue17947 messages
2013-05-11 19:10:46eli.benderskycreate