mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
0d4ca251b9
In general, the attribute of the same name is overwritten by executing an import statement. import a.b print(a.b.c) # 'c' of a/b/__init__.py from a.b.c import d print(a.b.c) # a/b/c.py However, this appears not true for the scenario described in the test case, and surprisingly, "from a.b.c import d" works even if "a.b.c" is not a module. This patch works around the problem by taking the right module from sys.modules if available. |
||
---|---|---|
.. | ||
__init__.py | ||
demandimportpy2.py | ||
demandimportpy3.py |