This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: pkgutil.get_loader throws deprecation warning due to internal deprecation
Type: behavior Stage: resolved
Components: Versions: Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, aronacher, brett.cannon, eric.snow, larry, ncoghlan, python-dev
Priority: release blocker Keywords: 3.4regression, patch

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

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

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: Nick 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: Nick 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: Nick 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: Nick 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
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
Date User Action Args
2022-04-11 14:57:59adminsetgithub: 65038
2014-03-17 06:30:57python-devsetmessages: + msg213815
2014-03-04 10:39:56python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg212708

resolution: fixed
stage: resolved
2014-03-03 21:31:56ncoghlansetmessages: + msg212675
2014-03-03 14:58:02brett.cannonsetmessages: + msg212640
2014-03-03 11:59:18ncoghlansetmessages: + msg212632
2014-03-03 11:39:41ncoghlansetfiles: + issue20839_migrate_pkgutil_to_find_spec.diff
keywords: + patch
messages: + msg212631
2014-03-03 11:31:56ncoghlansetmessages: + msg212629
2014-03-03 10:37:50ncoghlansetpriority: normal -> release blocker
nosy: + larry
2014-03-03 09:27:06Arfreversetnosy: + brett.cannon, ncoghlan, Arfrever, eric.snow
2014-03-03 08:23:31aronachersetmessages: + msg212618
2014-03-03 07:43:56aronachercreate