消息 [346861]
If you run with `-Xdev`/warnings turned on you get an idea of what's happening:
>>> builtins.__import__('', globals(), locals(), ('foo',), 1)
<stdin>:1: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
<module '__main__' (built-in)>
The check is being done in resolve_name() in import.c (https://github.com/python/cpython/blob/f9f8e3ce709ceb15c8db8c8dde940daf1febf13d/Python/import.c#L1543). My guess is there's an off-by-one error in the sanity check logic for attempting a relative import beyond the top-level package. |
|
| 日期 |
用户 |
动作 |
参数 |
| 2019-06-28 19:34:59 | brett.cannon | 修改 | recipients:
+ brett.cannon, eric.smith, serhiy.storchaka, Ben Lewis2 |
| 2019-06-28 19:34:59 | brett.cannon | 修改 | messageid: <1561750499.23.0.270390006821.issue37409@roundup.psfhosted.org> |
| 2019-06-28 19:34:59 | brett.cannon | 链接 | issue37409 messages |
| 2019-06-28 19:34:59 | brett.cannon | 创建 | |
|