PY-14811 Handle references from __all__, defined indirectly in the module

This commit is contained in:
Mikhail Golubev
2015-03-31 16:11:50 +03:00
parent ab891dacfb
commit 3d3c158863
14 changed files with 179 additions and 24 deletions
@@ -0,0 +1,18 @@
__all__ = ['foo']
class C(object):
def foo(self):
pass
_c = C()
def _init(g):
for name in dir(_c):
if not name.startswith('_'):
g[name] = getattr(_c, name)
_init(globals())
@@ -0,0 +1,5 @@
from b import foo
def use_foo():
print(foo)
@@ -0,0 +1,5 @@
from b import foo
def use_foo():
print(foo)
@@ -0,0 +1,18 @@
__all__ = ['foo']
class C(object):
def foo(self):
pass
_c = C()
def _init(g):
for name in dir(_c):
if not name.startswith('_'):
g[name] = getattr(_c, name)
_init(globals())
@@ -0,0 +1,18 @@
__all__ = ['foo']
class C(object):
def foo(self):
pass
_c = C()
def _init(g):
for name in dir(_c):
if not name.startswith('_'):
g[name] = getattr(_c, name)
_init(globals())
@@ -0,0 +1,5 @@
from b import foo as bar
def use_foo():
print(bar)
@@ -0,0 +1,5 @@
from b import foo as bar
def use_foo():
print(bar)
@@ -0,0 +1,18 @@
__all__ = ['foo']
class C(object):
def foo(self):
pass
_c = C()
def _init(g):
for name in dir(_c):
if not name.startswith('_'):
g[name] = getattr(_c, name)
_init(globals())