parent_stmt property never raises an error now, returns None

This commit is contained in:
David Halter
2012-07-19 17:14:42 +02:00
parent 6bea28938f
commit 6ef99d4338
2 changed files with 4 additions and 2 deletions

View File

@@ -746,8 +746,10 @@ class Call(object):
def parent_stmt(self): def parent_stmt(self):
if self._parent_stmt: if self._parent_stmt:
return self._parent_stmt return self._parent_stmt
else: elif self.parent:
return self.parent.parent_stmt return self.parent.parent_stmt
else:
return None
@parent_stmt.setter @parent_stmt.setter
def parent_stmt(self, value): def parent_stmt(self, value):

View File

@@ -6,7 +6,7 @@ second = ""
class TestClass(object): class TestClass(object):
var_class = TestClass(1) var_class = TestClass(1)
def __init__(self2, first_param, second_param): def __init__(self2, first_param, second_param, third=1.0):
self2.var_inst = first_param self2.var_inst = first_param
self2.second = second_param self2.second = second_param
self2.first = first_param self2.first = first_param