mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-19 23:09:43 +08:00
fix IndexErrors which sometimes happened, related to inter-module param searching
This commit is contained in:
+4
-2
@@ -127,9 +127,11 @@ class CachedMetaClass(type):
|
|||||||
|
|
||||||
class Executable(parsing.Base):
|
class Executable(parsing.Base):
|
||||||
""" An instance is also an executable - because __init__ is called """
|
""" 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
|
self.base = base
|
||||||
# The param input array.
|
# The param input array.
|
||||||
|
if var_args is None:
|
||||||
|
var_args = parsing.Array(None, None)
|
||||||
self.var_args = var_args
|
self.var_args = var_args
|
||||||
|
|
||||||
def get_parent_until(self, *args, **kwargs):
|
def get_parent_until(self, *args, **kwargs):
|
||||||
@@ -141,7 +143,7 @@ class Executable(parsing.Base):
|
|||||||
|
|
||||||
class Instance(use_metaclass(CachedMetaClass, Executable)):
|
class Instance(use_metaclass(CachedMetaClass, Executable)):
|
||||||
""" This class is used to evaluate instances. """
|
""" 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)
|
super(Instance, self).__init__(base, var_args)
|
||||||
if str(base.name) in ['list', 'set'] \
|
if str(base.name) in ['list', 'set'] \
|
||||||
and builtin.builtin_scope == base.get_parent_until():
|
and builtin.builtin_scope == base.get_parent_until():
|
||||||
|
|||||||
+3
-1
@@ -422,7 +422,8 @@ class Flow(Scope):
|
|||||||
else:
|
else:
|
||||||
self.set_vars = set_vars
|
self.set_vars = set_vars
|
||||||
for s in self.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
|
@property
|
||||||
def parent(self):
|
def parent(self):
|
||||||
@@ -1601,6 +1602,7 @@ class PyFuzzyParser(object):
|
|||||||
self.freshscope = True
|
self.freshscope = True
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
self.module.temp_used_names = []
|
||||||
token_type, tok = self.next()
|
token_type, tok = self.next()
|
||||||
#debug.dbg('main: tok=[%s] type=[%s] indent=[%s]'\
|
#debug.dbg('main: tok=[%s] type=[%s] indent=[%s]'\
|
||||||
# % (tok, tokenize.tok_name[token_type], start_position[0]))
|
# % (tok, tokenize.tok_name[token_type], start_position[0]))
|
||||||
|
|||||||
Reference in New Issue
Block a user