AttributeError chaining bug #1944 fix

This commit is contained in:
Lev Maximov 2016-09-18 22:34:48 +07:00
parent 8639bf7554
commit 65be1231b1
1 changed files with 3 additions and 4 deletions

View File

@ -205,11 +205,10 @@ class PyobjContext(object):
class PyobjMixin(PyobjContext): class PyobjMixin(PyobjContext):
def obj(): def obj():
def fget(self): def fget(self):
try: obj = getattr(self, '_obj', None)
return self._obj if obj is None:
except AttributeError:
self._obj = obj = self._getobj() self._obj = obj = self._getobj()
return obj return obj
def fset(self, value): def fset(self, value):
self._obj = value self._obj = value
return property(fget, fset, None, "underlying python object") return property(fget, fset, None, "underlying python object")