Message224804
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 |
|
Date |
User |
Action |
Args |
2014-08-05 04:37:01 | ezio.melotti | set | recipients:
+ ezio.melotti, michael.foord, chepner |
2014-08-05 04:37:01 | ezio.melotti | set | messageid: <1407213421.33.0.415100560154.issue22138@psf.upfronthosting.co.za> |
2014-08-05 04:37:01 | ezio.melotti | link | issue22138 messages |
2014-08-05 04:37:01 | ezio.melotti | create | |
|