Skip to content

Commit 0f5e28f

Browse files
committed
Add __annotations__ case to ObjectProxy.__delattr__
ObjectProxy.__setattr__ has special handling for both __qualname__ and __annotations__, forwarding them to both the proxy and the wrapped object. However, __delattr__ only handles __qualname__ and misses __annotations__, so deleting annotations on the proxy doesn't propagate to the wrapped object. This adds the missing __annotations__ branch to __delattr__ to match the behavior of __setattr__.
1 parent 27c5248 commit 0f5e28f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/wrapt/wrappers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,10 @@ def __delattr__(self, name):
283283
object.__delattr__(self, name)
284284
delattr(self.__wrapped__, name)
285285

286+
elif name == "__annotations__":
287+
object.__delattr__(self, name)
288+
delattr(self.__wrapped__, name)
289+
286290
elif hasattr(type(self), name):
287291
object.__delattr__(self, name)
288292

0 commit comments

Comments
 (0)