mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 16:31:02 +03:00
3379250232
This is the behavior of the default __import__() function, which doesn't validate the existence of the fromlist items. Later on, the missing attribute is detected while processing the import statement. https://hg.python.org/cpython/file/v2.7.13/Python/import.c#l2575 The comtypes library relies on this (maybe) undocumented behavior, and we got a bug report to TortoiseHg, sigh. https://bitbucket.org/tortoisehg/thg/issues/4647/ The test added at 0be19b069edf verifies the behavior of the import statement, so this patch only adds the test of __import__() function and works around CPython/PyPy difference.
24 lines
910 B
Plaintext
24 lines
910 B
Plaintext
os = <unloaded module 'os'>
|
|
os.system = <built-in function system>
|
|
os = <module 'os' from '?'>
|
|
util = <unloaded module 'util'>
|
|
util.system = <function system at 0x?>
|
|
util = <module 'mercurial.util' from '?'>
|
|
util.system = <function system at 0x?>
|
|
hgweb = <unloaded module 'hgweb'>
|
|
hgweb_mod = <unloaded module 'hgweb_mod'>
|
|
hgweb = <module 'mercurial.hgweb' from '?'>
|
|
fred = <unloaded module 're'>
|
|
re = <unloaded module 'sys'>
|
|
fred = <unloaded module 're'>
|
|
fred.sub = <function sub at 0x?>
|
|
fred = <proxied module 're'>
|
|
re = <unloaded module 'sys'>
|
|
re.stderr = <open file '<whatever>', mode 'w' at 0x?>
|
|
re = <proxied module 'sys'>
|
|
contextlib = <unloaded module 'contextlib'>
|
|
contextlib.unknownattr = ImportError: cannot import name unknownattr
|
|
__import__('contextlib', ..., ['unknownattr']) = <module 'contextlib' from '?'>
|
|
hasattr(contextlibimp, 'unknownattr') = False
|
|
node = <module 'mercurial.node' from '?'>
|