summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp')
-rw-r--r--sleekxmpp/xmlstream/stanzabase.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/sleekxmpp/xmlstream/stanzabase.py b/sleekxmpp/xmlstream/stanzabase.py
index e1a2085a..2f6416d5 100644
--- a/sleekxmpp/xmlstream/stanzabase.py
+++ b/sleekxmpp/xmlstream/stanzabase.py
@@ -326,7 +326,10 @@ class ElementBase(object):
#: If not, then :attr:`parent` is ``None``.
self.parent = None
if parent is not None:
- self.parent = weakref.ref(parent)
+ if not isinstance(parent, weakref.ReferenceType):
+ self.parent = weakref.ref(parent)
+ else:
+ self.parent = parent
if self.subitem is not None:
for sub in self.subitem: