Skip to content

Commit

Permalink
Merge 2e1b8ed into be82756
Browse files Browse the repository at this point in the history
  • Loading branch information
jensens committed Feb 4, 2020
2 parents be82756 + 2e1b8ed commit d6b50a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Expand Up @@ -67,6 +67,10 @@
of) interface adaptation. See `issue 163
<https://github.com/zopefoundation/zope.interface/issues/163>`_.

- Fixes an possible uninitialized instance variable `_dependents` in
`Specification.unsubscribe`.
See `issue 165 <https://github.com/zopefoundation/zope.interface/issues/165>`_.

4.7.1 (2019-11-11)
==================

Expand Down
2 changes: 2 additions & 0 deletions src/zope/interface/interface.py
Expand Up @@ -238,6 +238,8 @@ def subscribe(self, dependent):
self._dependents[dependent] = self.dependents.get(dependent, 0) + 1

def unsubscribe(self, dependent):
if self._dependents is None:
self._dependents = weakref.WeakKeyDictionary()
try:
n = self._dependents[dependent]
except TypeError:
Expand Down

0 comments on commit d6b50a9

Please sign in to comment.