summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-10-12 13:02:04 -0400
committerBenjamin Peterson <benjamin@python.org>2014-10-12 13:02:04 -0400
commit11d35fd4c7e7fb477557d262e327c81f344ec00d (patch)
tree9cb671db1a7882546ed16ddecf0a200083fc9a1f
parentd73857d4005ec2a0a7087434eacb5c857db6ea56 (diff)
parent46385c80c73671751c72c6c5fb68e34f0d7bdfaf (diff)
downloadsix-11d35fd4c7e7fb477557d262e327c81f344ec00d.tar.gz
Merged in harlowja/six/fix-delattr (pull request #54)
Fix issue #98
-rw-r--r--six.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/six.py b/six.py
index 4252fdf..0df4538 100644
--- a/six.py
+++ b/six.py
@@ -88,8 +88,12 @@ class _LazyDescr(object):
def __get__(self, obj, tp):
result = self._resolve()
setattr(obj, self.name, result) # Invokes __set__.
- # This is a bit ugly, but it avoids running this again.
- delattr(obj.__class__, self.name)
+ try:
+ # This is a bit ugly, but it avoids running this again by
+ # removing this descriptor.
+ delattr(obj.__class__, self.name)
+ except AttributeError:
+ pass
return result