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.
Created on 2012年07月18日 11:56 by ncoghlan, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (5) | |||
|---|---|---|---|
| msg165759 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2012年07月18日 11:56 | |
$ ./python -Wdefault
Python 3.3.0b1 (default:8bf691d0b004+, Jul 15 2012, 23:20:06)
[GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkgutil
>>> list(pkgutil.walk_packages("."))
/home/ncoghlan/devel/py3k/Lib/inspect.py:453: DeprecationWarning: inspect.getmoduleinfo() is deprecated
info = getmoduleinfo(path)
/home/ncoghlan/devel/py3k/Lib/inspect.py:445: DeprecationWarning: imp.get_suffixes() is deprecated; use the constants defined on importlib.machinery instead
for suffix, mode, mtype in imp.get_suffixes()]
[(FileFinder('.'), 'foo', False), (FileFinder('.'), 'python-gdb', False), (FileFinder('.'), 'setup', False)]
The problem is the calls to inspect.getmodulename().
Do these APIs really need to be deprecated? Can't they just be redirected to importlib instead?
|
|||
| msg165766 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2012年07月18日 12:59 | |
I think the imp functions do need to go away. They perpetuate an absolutely horrendous API that I'm trying to slowly kill (and the underlying imp code is already reusing importlib). They already are a burden for future API growth as people already rely on imp.find_module() and imp.load_module() in such a way that untangling is right pain. |
|||
| msg165769 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年07月18日 13:15 | |
New changeset af7961e1c362 by Nick Coghlan in branch 'default': Close #15387: inspect.getmodulename() now uses a new importlib.machinery.all_suffixes() API rather than the deprecated inspect.getmoduleinfo() http://hg.python.org/cpython/rev/af7961e1c362 |
|||
| msg165770 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2012年07月18日 13:20 | |
The problem turned out to just be inspect.getmodulename() still relying on the deprecated inspect.getmoduleinfo(), so I changed it to be based on importlib.machinery instead. I did make an importlib API addition to do it though - the all_suffixes() function dynamically adds together all the suffixes relevant for the current process so it will pick up any modification post import, while still allowing code that doesn't care about module types to ignore the details of the different kinds. |
|||
| msg165775 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2012年07月18日 13:49 | |
RE: the API addition: fine by me if it makes your life easier. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:33 | admin | set | github: 59592 |
| 2012年07月18日 13:49:23 | brett.cannon | set | messages: + msg165775 |
| 2012年07月18日 13:20:39 | ncoghlan | set | messages: + msg165770 |
| 2012年07月18日 13:15:11 | python-dev | set | status: open -> closed nosy: + python-dev messages: + msg165769 resolution: fixed stage: needs patch -> resolved |
| 2012年07月18日 12:59:45 | brett.cannon | set | messages: + msg165766 |
| 2012年07月18日 11:56:13 | ncoghlan | create | |