Skip to content

Commit

Permalink
Clean up cache when instance is deleted.
Browse files Browse the repository at this point in the history
  • Loading branch information
tlambert03 committed Nov 6, 2023
1 parent a727c96 commit e5f240a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/psygnal/_group_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,7 @@ def __get__(

# clean up the cache when the instance is deleted
with contextlib.suppress(TypeError):
# mypy says too many attributes for weakref.finalize, but it's wrong.
weakref.finalize(instance, self._instance_map.pop, obj_id, None) # type: ignore [call-arg]
weakref.finalize(instance, self._instance_map.pop, obj_id, None)

return self._instance_map[obj_id]

Expand Down

0 comments on commit e5f240a

Please sign in to comment.