diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-10-12 13:02:04 -0400 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-10-12 13:02:04 -0400 |
commit | 11d35fd4c7e7fb477557d262e327c81f344ec00d (patch) | |
tree | 9cb671db1a7882546ed16ddecf0a200083fc9a1f | |
parent | d73857d4005ec2a0a7087434eacb5c857db6ea56 (diff) | |
parent | 46385c80c73671751c72c6c5fb68e34f0d7bdfaf (diff) | |
download | six-11d35fd4c7e7fb477557d262e327c81f344ec00d.tar.gz |
Merged in harlowja/six/fix-delattr (pull request #54)
Fix issue #98
-rw-r--r-- | six.py | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 |