Message 294656 - Python tracker
Message294656
| Author | brett.cannon |
|---|---|
| Recipients | brett.cannon, eric.snow, ncoghlan, pitrou, python-dev, scoder, superluser |
| Date | 2017-05-28.19:18:17 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1495999097.98.0.679293212692.issue25791@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
OK, so the warning is triggered if __package is None or __spec__ is None (https://github.com/python/cpython/blob/ac5bbd43bc7b769c13ae0412cb28a3521f4d4ff1/Lib/importlib/_bootstrap.py#L1038). That's defined in _calc___package__() which is only called if index != 0 when calling __import__() (https://github.com/python/cpython/blob/ac5bbd43bc7b769c13ae0412cb28a3521f4d4ff1/Lib/importlib/_bootstrap.py#L1062 or https://github.com/python/cpython/blob/ac5bbd43bc7b769c13ae0412cb28a3521f4d4ff1/Python/import.c#L1520). So the question becomes how is Cython importing modules? This warning should only be triggered if you're attempting a relative import from within a package (and thus have a level > 0). Based on Antoine's Cython issue, since something like multidict isn't a package it would suggest either Cython is setting the level > 0 when it doesn't mean to or there's a bug somewhere with level == 0 and yet Python is still trying to calculate the parent package for no reason. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2017-05-28 19:18:18 | brett.cannon | set | recipients: + brett.cannon, ncoghlan, pitrou, scoder, python-dev, eric.snow, superluser |
| 2017-05-28 19:18:17 | brett.cannon | set | messageid: <1495999097.98.0.679293212692.issue25791@psf.upfronthosting.co.za> |
| 2017-05-28 19:18:17 | brett.cannon | link | issue25791 messages |
| 2017-05-28 19:18:17 | brett.cannon | create | |