1
0
forked from VimPlug/jedi

Fix a globals context issue, fixes #1435

This commit is contained in:
Dave Halter
2019-12-01 01:27:49 +01:00
parent e81c241905
commit b13c4c446f
4 changed files with 15 additions and 2 deletions

View File

@@ -101,7 +101,7 @@ class ModuleMixin(SubModuleDictMixin):
parent_context=self.as_context(),
origin_scope=origin_scope
),
GlobalNameFilter(self, self.tree_node),
GlobalNameFilter(self.as_context(), self.tree_node),
)
yield DictFilter(self.sub_modules_dict())
yield DictFilter(self._module_attributes_dict())

View File

@@ -188,6 +188,14 @@ def init_global_var_predefined():
global_var_predefined
def global_as_import():
from import_tree import globals
#? ['foo']
globals.foo
#? int()
globals.foo
# -----------------
# within docstrs
# -----------------

View File

@@ -0,0 +1,5 @@
def something():
global foo
foo = 3

View File

@@ -75,7 +75,7 @@ from import_tree.pkg.mod1 import not_existant, # whitespace before
from import_tree.pkg.mod1 import not_existant,
#? 22 ['mod1']
from import_tree.pkg. import mod1
#? 17 ['mod1', 'mod2', 'random', 'pkg', 'rename1', 'rename2', 'classes', 'recurse_class1', 'recurse_class2', 'invisible_pkg', 'flow_import']
#? 17 ['mod1', 'mod2', 'random', 'pkg', 'rename1', 'rename2', 'classes', 'globals', 'recurse_class1', 'recurse_class2', 'invisible_pkg', 'flow_import']
from import_tree. import pkg
#? 18 ['pkg']