New submission from 邱伟略: the working directory is like below:
bug/ dirc/ __init__.py foo.py foo2.py __init__.py foo1.py in foo.py: ``` class Event(object): pass ``` in foo2.py: ``` from a.foo import Event def fun(): return Event() ``` in foo1.py: ``` from bug.a.foo import Event from bug.a.foo2 import fun assert isinstance(fun(), Event) ``` when i try to execute the code in foo1.py, i got an assertion error. but if i change foo2.py to: ``` from ..a.foo import Event def fun(): return Event() ``` the code in foo1.py can be done well without the assertion error. i think it's about the import mechanism. i have checked pep328 I think when i do "from a.foo import Event", python import Event by the package name "a.foo.Event", but "from ..a.foo import Event" is going to import Event by "bug.a.foo.Event". and it is totally different in python. is it kind of bug python should prevent? ---------- components: macOS messages: 298018 nosy: ned.deily, ronaldoussoren, 邱伟略 priority: normal severity: normal status: open title: import class not isinstance of the class type: behavior versions: Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30888> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com