weakref problem, references were killed to early

This commit is contained in:
David Halter
2012-09-03 16:59:12 +02:00
parent 663d808f9f
commit 77dac95ee0
2 changed files with 17 additions and 9 deletions

View File

@@ -66,13 +66,7 @@ class Definition(object):
self.definition = definition
self._def_parent = self.definition.parent() # just here to limit gc
par = self.definition
while True:
if par.parent() is not None:
par = par.parent()
else:
break
self.module_path = str(par.path)
self.module_path = str(self.definition.get_parent_until().path)
def get_name(self):
try:
@@ -251,8 +245,9 @@ def get_definitions(source, line, column, source_path):
goto_path = f.get_path_under_cursor()
scopes = _prepare_goto(source, pos, source_path, f, goto_path)
d = [Definition(s) for s in set(scopes)]
_clear_caches()
return [Definition(s) for s in set(scopes)]
return d
def goto(source, line, column, source_path):
@@ -311,8 +306,9 @@ def goto(source, line, column, source_path):
names += s.get_defined_names()
names = remove_unreal_imports(names)
definitions = [n for n in names if n.names[-1] == search_name]
d = [Definition(d) for d in set(definitions)]
_clear_caches()
return [Definition(d) for d in set(definitions)]
return d
def set_debug_function(func_cb):

View File

@@ -108,3 +108,15 @@ mod1.a
#! ['a=1.0']
from import_tree.pkg.mod1 import a
# -----------------
# anonymous classes
# -----------------
def func():
class A():
def b(self):
return 1
return A()
#! 8 ['def b']
func().b()