summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/handler/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/xmlstream/handler/base.py')
-rw-r--r--sleekxmpp/xmlstream/handler/base.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/sleekxmpp/xmlstream/handler/base.py b/sleekxmpp/xmlstream/handler/base.py
index 6ec9b6a3..7f05c757 100644
--- a/sleekxmpp/xmlstream/handler/base.py
+++ b/sleekxmpp/xmlstream/handler/base.py
@@ -6,6 +6,8 @@
See the file LICENSE for copying permission.
"""
+import weakref
+
class BaseHandler(object):
@@ -43,7 +45,10 @@ class BaseHandler(object):
stream -- The XMLStream instance the handler should monitor.
"""
self.name = name
- self.stream = stream
+ if stream is not None:
+ self.stream = weakref.ref(stream)
+ else:
+ self.stream = None
self._destroy = False
self._payload = None
self._matcher = matcher