Author ezio.melotti
Recipients chepner, ezio.melotti, michael.foord
Date 2014-08-05.04:37:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1407213421.33.0.415100560154.issue22138@psf.upfronthosting.co.za>
In-reply-to
Content
The issue seems to affect special attributes that can't be deleted.
In Lib/unittest/mock.py:1329, patch() tried to delete the attribute, and then, if it doesn't exist, it restores the previous value.  However some special attributes exist even after they are deleted, but their initial value is lost:
>>> def foo(x:int=5, y:int=3): return x + y
... 
>>> foo.__defaults__
(5, 3)
>>> del foo.__defaults__
>>> foo.__defaults__
>>> foo.__annotations__
{'y': <class 'int'>, 'x': <class 'int'>}
>>> del foo.__annotations__
>>> foo.__annotations__
{}
>>> foo.__qualname__
'foo'
>>> del foo.__qualname__
TypeError: __qualname__ must be set to a string object
History
Date User Action Args
2014-08-05 04:37:01ezio.melottisetrecipients: + ezio.melotti, michael.foord, chepner
2014-08-05 04:37:01ezio.melottisetmessageid: <1407213421.33.0.415100560154.issue22138@psf.upfronthosting.co.za>
2014-08-05 04:37:01ezio.melottilinkissue22138 messages
2014-08-05 04:37:01ezio.melotticreate