mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
found the memory-critical pieces. also removed old debug code
This commit is contained in:
@@ -75,7 +75,8 @@ def clear_caches():
|
|||||||
for m in memoize_caches:
|
for m in memoize_caches:
|
||||||
m.clear()
|
m.clear()
|
||||||
|
|
||||||
memoize_caches = []
|
# memorize_caches must never be deleted, because the dicts will get lost in
|
||||||
|
# the wrappers.
|
||||||
statement_path = []
|
statement_path = []
|
||||||
faked_scopes = []
|
faked_scopes = []
|
||||||
|
|
||||||
|
|||||||
13
functions.py
13
functions.py
@@ -70,6 +70,7 @@ class Definition(object):
|
|||||||
def __init__(self, definition):
|
def __init__(self, definition):
|
||||||
""" The definition of a function """
|
""" The definition of a function """
|
||||||
self.definition = definition
|
self.definition = definition
|
||||||
|
self._def_parent = self.definition.parent() # just here to limit gc
|
||||||
|
|
||||||
par = self.definition
|
par = self.definition
|
||||||
while True:
|
while True:
|
||||||
@@ -319,15 +320,3 @@ def set_debug_function(func_cb):
|
|||||||
|
|
||||||
def _clear_caches():
|
def _clear_caches():
|
||||||
evaluate.clear_caches()
|
evaluate.clear_caches()
|
||||||
return
|
|
||||||
import gc
|
|
||||||
#gc.set_debug(gc.DEBUG_STATS | gc.DEBUG_COLLECTABLE | gc.DEBUG_UNCOLLECTABLE | gc.DEBUG_OBJECTS)
|
|
||||||
#gc.collect()
|
|
||||||
count = 0
|
|
||||||
for o in gc.get_objects():
|
|
||||||
if isinstance(o, parsing.Module):
|
|
||||||
pass
|
|
||||||
count += 1
|
|
||||||
#print o
|
|
||||||
print count
|
|
||||||
#exit()
|
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ import parsing
|
|||||||
import builtin
|
import builtin
|
||||||
import debug
|
import debug
|
||||||
|
|
||||||
files = {}
|
|
||||||
load_module_cb = None
|
|
||||||
|
|
||||||
|
|
||||||
class Module(builtin.CachedModule):
|
class Module(builtin.CachedModule):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1334,7 +1334,6 @@ class PyFuzzyParser(object):
|
|||||||
"""
|
"""
|
||||||
buf = BytesIO(self.code)
|
buf = BytesIO(self.code)
|
||||||
self.gen = tokenize_func(buf.readline)
|
self.gen = tokenize_func(buf.readline)
|
||||||
self.currentscope = self.scope # TODO remove?
|
|
||||||
|
|
||||||
extended_flow = ['else', 'elif', 'except', 'finally']
|
extended_flow = ['else', 'elif', 'except', 'finally']
|
||||||
statement_toks = ['{', '[', '(', '`']
|
statement_toks = ['{', '[', '(', '`']
|
||||||
@@ -1346,8 +1345,6 @@ class PyFuzzyParser(object):
|
|||||||
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, token_type, start_position[0]))
|
# % (tok, token_type, start_position[0]))
|
||||||
#print('main: tok=[%s] type=[%s] indent=[%s]'
|
|
||||||
# % (tok, tokenize.tok_name[token_type], self.start_pos[0]))
|
|
||||||
|
|
||||||
while token_type == tokenize.DEDENT \
|
while token_type == tokenize.DEDENT \
|
||||||
and self.scope != self.module:
|
and self.scope != self.module:
|
||||||
|
|||||||
9
test/completion/thirdparty/PySide_.py
vendored
9
test/completion/thirdparty/PySide_.py
vendored
@@ -1,9 +0,0 @@
|
|||||||
from PySide import QtCore
|
|
||||||
from PySide import QtGui
|
|
||||||
|
|
||||||
##? ['QEvent']
|
|
||||||
QtCore.QEvent
|
|
||||||
|
|
||||||
##? []
|
|
||||||
QtGui.QButton
|
|
||||||
|
|
||||||
@@ -9,8 +9,8 @@ sys.path.append('.')
|
|||||||
import functions
|
import functions
|
||||||
from _compatibility import unicode, BytesIO
|
from _compatibility import unicode, BytesIO
|
||||||
|
|
||||||
only_line = int(sys.argv[2]) if len(sys.argv) > 2 else None
|
only_line = [int(o) for o in sys.argv[2:]]
|
||||||
if only_line is not None:
|
if only_line:
|
||||||
import debug
|
import debug
|
||||||
debug.debug_function = \
|
debug.debug_function = \
|
||||||
functions.debug.print_to_stdout
|
functions.debug.print_to_stdout
|
||||||
@@ -164,7 +164,7 @@ def run_test(source, f_name):
|
|||||||
correct = None
|
correct = None
|
||||||
else:
|
else:
|
||||||
# reset the test, if only one specific test is wanted
|
# reset the test, if only one specific test is wanted
|
||||||
if only_line and line_nr != only_line:
|
if only_line and line_nr not in only_line:
|
||||||
correct = None
|
correct = None
|
||||||
return tests, fails
|
return tests, fails
|
||||||
|
|
||||||
@@ -209,5 +209,6 @@ print('\nSummary:')
|
|||||||
for s in summary:
|
for s in summary:
|
||||||
print(s)
|
print(s)
|
||||||
|
|
||||||
|
|
||||||
exit_code = 0 if tests_pass else 1
|
exit_code = 0 if tests_pass else 1
|
||||||
sys.exit(exit_code)
|
sys.exit(exit_code)
|
||||||
|
|||||||
Reference in New Issue
Block a user