fix IndexErrors which sometimes happened, related to inter-module param searching

This commit is contained in:
David Halter
2012-09-29 17:54:22 +02:00
parent 1ae2a36838
commit 99cd894a7b
2 changed files with 7 additions and 3 deletions

View File

@@ -127,9 +127,11 @@ class CachedMetaClass(type):
class Executable(parsing.Base):
""" An instance is also an executable - because __init__ is called """
def __init__(self, base, var_args=parsing.Array(None, None)):
def __init__(self, base, var_args=None):
self.base = base
# The param input array.
if var_args is None:
var_args = parsing.Array(None, None)
self.var_args = var_args
def get_parent_until(self, *args, **kwargs):
@@ -141,7 +143,7 @@ class Executable(parsing.Base):
class Instance(use_metaclass(CachedMetaClass, Executable)):
""" This class is used to evaluate instances. """
def __init__(self, base, var_args=parsing.Array(None, None)):
def __init__(self, base, var_args=None):
super(Instance, self).__init__(base, var_args)
if str(base.name) in ['list', 'set'] \
and builtin.builtin_scope == base.get_parent_until():

View File

@@ -422,7 +422,8 @@ class Flow(Scope):
else:
self.set_vars = set_vars
for s in self.set_vars:
s.parent().parent = weakref.ref(self)
s.parent().parent = lambda: self
s.parent = weakref.ref(self)
@property
def parent(self):
@@ -1601,6 +1602,7 @@ class PyFuzzyParser(object):
self.freshscope = True
while True:
try:
self.module.temp_used_names = []
token_type, tok = self.next()
#debug.dbg('main: tok=[%s] type=[%s] indent=[%s]'\
# % (tok, tokenize.tok_name[token_type], start_position[0]))