Skip to content

Commit

Permalink
Disable the star import cache.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhalter committed Apr 25, 2015
1 parent 06d134a commit 0203461
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
5 changes: 4 additions & 1 deletion jedi/evaluate/representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,10 @@ def names_dicts(self, search_global):
yield dict((str(n), [GlobalName(n)]) for n in self.base.global_names)
yield self._sub_modules_dict()

@cache_star_import
# I'm not sure if the star import cache is really that effective anymore
# with all the other really fast import caches. Recheck. Also we would need
# to push the star imports into Evaluator.modules, if we reenable this.
#@cache_star_import
@memoize_default([])
def star_imports(self):
modules = []
Expand Down
12 changes: 7 additions & 5 deletions scripts/memory_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,17 @@ def main(mods):
for mod in mods:
elapsed, used = profile_preload(mod)
if used > 0:
print('%8.1f | %8d | %s' % (elapsed, used, mod))
print('%8.2f | %8d | %s' % (elapsed, used, mod))
print('------------------------------')
elapsed = time.time() - t0
used = used_memory() - baseline
print('%8.1f | %8d | %s' % (elapsed, used, 'Total'))
print('%8.2f | %8d | %s' % (elapsed, used, 'Total'))


if __name__ == '__main__':
mods = ['re', 'numpy', 'scipy', 'scipy.sparse', 'scipy.stats',
'wx', 'decimal', 'PyQt4.QtGui', 'PySide.QtGui', 'Tkinter']
mods += sys.argv[1:]
if sys.argv[1:]:
mods = sys.argv[1:]
else:
mods = ['re', 'numpy', 'scipy', 'scipy.sparse', 'scipy.stats',
'wx', 'decimal', 'PyQt4.QtGui', 'PySide.QtGui', 'Tkinter']
main(mods)
2 changes: 2 additions & 0 deletions test/completion/import_tree/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

from . import invisible_pkg

the_pkg = invisible_pkg

invisible_pkg = 1
8 changes: 8 additions & 0 deletions test/completion/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ def test_import_priorities():
from import_tree import the_pkg, invisible_pkg
#? int()
invisible_pkg
# In real Python, this would be the module, but it's not, because Jedi
# doesn't care about most stateful issues such as __dict__, which it would
# need to, to do this in a correct way.
#? int()
the_pkg
# Importing foo is still possible, even though inivisible_pkg got changed.
#? float()
from import_tree.invisible_pkg import foo


# -----------------
Expand Down

0 comments on commit 0203461

Please sign in to comment.