Issue 20839: pkgutil.get_loader throws deprecation warning due to internal deprecation (original) (raw)

Created on 2014-03-03 07:43 by aronacher, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue20839_migrate_pkgutil_to_find_spec.diff ncoghlan,2014-03-03 11:39 Switch to using find_spec in pkgutil review
Messages (9)
msg212615 - (view) Author: Armin Ronacher (aronacher) * (Python committer) Date: 2014-03-03 07:43
pkgutil.get_loader calls pkgutil.find_loader which calls importlib.find_loader The latter logs a deprecation warning about it being replaced by importlib.util.find_spec. This is a regression in 3.4 as far as I can see.
msg212618 - (view) Author: Armin Ronacher (aronacher) * (Python committer) Date: 2014-03-03 08:23
This also happens with the latest hg version. I could not make an isolated test case unfortunately but it happens on the flask testsuite if run on 3.4.
msg212629 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2014-03-03 11:31
Ah, I think I see what may have happened - when we finally switched all the stdlib importers over to PEP 302 (and consistently set __loader__), the pkgutil.get_loader fallback to pkgutil.find_loader stopped being exercised by the test suite (it's currently missing lower level unit tests), and so we missed that it was still calling a deprecated API. (And we don't currently have any CI set up to warn us when coverage of a module goes backwards) I'll add some new tests to get coverage and change it to use importlib.util.find_spec instead.
msg212631 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2014-03-03 11:39
Attached patch adds some appropriate unit tests, switches pkgutil.find_loader over to using importlib.util.find_spec and updates the docs appropriately. I also filed issue 20842 relating to the fact that the pkgutil docs still refer to PEP 302 when they should be referring to the glossary terms instead.
msg212632 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2014-03-03 11:59
Brett, Eric - if this looks right to you, feel free to commit and create the issue for Larry to incorporate it into 3.4.0.
msg212640 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2014-03-03 14:58
LGTM, but I won't be able to commit it until Friday so hopefully Eric or you can do it sooner.
msg212675 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2014-03-03 21:31
OK, I can add it tonight.
msg212708 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-03-04 10:39
New changeset ea827c809765 by Nick Coghlan in branch 'default': Close #20839: pkgutil.find_loader now uses importlib.util.find_spec http://hg.python.org/cpython/rev/ea827c809765
msg213815 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-03-17 06:30
New changeset a8b30fd6ee4f by Nick Coghlan in branch '3.4': Close #20839: pkgutil.find_loader now uses importlib.util.find_spec http://hg.python.org/cpython/rev/a8b30fd6ee4f
History
Date User Action Args
2022-04-11 14:57:59 admin set github: 65038
2014-03-17 06:30:57 python-dev set messages: +
2014-03-04 10:39:56 python-dev set status: open -> closednosy: + python-devmessages: + resolution: fixedstage: resolved
2014-03-03 21:31:56 ncoghlan set messages: +
2014-03-03 14:58:02 brett.cannon set messages: +
2014-03-03 11:59:18 ncoghlan set messages: +
2014-03-03 11:39:41 ncoghlan set files: + issue20839_migrate_pkgutil_to_find_spec.diffkeywords: + patchmessages: +
2014-03-03 11:31:56 ncoghlan set messages: +
2014-03-03 10:37:50 ncoghlan set priority: normal -> release blockernosy: + larry
2014-03-03 09:27:06 Arfrever set nosy: + brett.cannon, ncoghlan, Arfrever, eric.snow
2014-03-03 08:23:31 aronacher set messages: +
2014-03-03 07:43:56 aronacher create