61 Commits

Author SHA1 Message Date
Victor Stinner
98ce7b107e bpo-41006: pkgutil imports lazily re (GH-20939)
The pkgutil module now imports lazily the re module to speedup Python
startup time.
2020-06-17 19:11:50 +02:00
Vinay Sajip
4f17c5cd9a bpo-12915: Improve Unicode support for package names and attributes. (GH-18517) 2020-02-28 14:26:27 +00:00
Vinay Sajip
1ed61617a4 bpo-12915: Add pkgutil.resolve_name (GH-18310) 2020-02-14 22:02:13 +00:00
Benjamin Peterson
42aa93b8ff closes bpo-31650: PEP 552 (Deterministic pycs) implementation (#4575)
Python now supports checking bytecode cache up-to-dateness with a hash of the
source contents rather than volatile source metadata. See the PEP for details.

While a fairly straightforward idea, quite a lot of code had to be modified due
to the pervasiveness of pyc implementation details in the codebase. Changes in
this commit include:

- The core changes to importlib to understand how to read, validate, and
  regenerate hash-based pycs.

- Support for generating hash-based pycs in py_compile and compileall.

- Modifications to our siphash implementation to support passing a custom
  key. We then expose it to importlib through _imp.

- Updates to all places in the interpreter, standard library, and tests that
  manually generate or parse pyc files to grok the new format.

- Support in the interpreter command line code for long options like
  --check-hash-based-pycs.

- Tests and documentation for all of the above.
2017-12-09 10:26:52 -08:00
Sanyam Khurana
b9c3da5c89 bpo-24744: Raises error in pkgutil.walk_packages if path is str (#1926)
bpo-24744: Raise error in pkgutil.walk_packages if path is str

Previously an empty result list was accidentallly returned, since the
code iterated over the string as if it were the expected list of paths,
and of course found nothing.
2017-06-13 13:11:14 -04:00
Eric Snow
d5f9223981 Issue #17211: Yield a namedtuple in pkgutil.
Patch by Ramchandra Apte.
2016-09-07 18:37:17 -07:00
Senthil Kumaran
56b4872ff5 [merge from 3.5] - Update pkgutil docs to reference appropriate finder and loader object documentation.
Initial patch contributed by Jaysinh shukla.
2016-09-05 17:16:06 -07:00
Senthil Kumaran
4672060d86 Update pkgutil docs to reference appropriate finder and loader object documentation.
Initial patch contributed by Jaysinh shukla.
2016-09-05 17:11:51 -07:00
Brett Cannon
fdcdd9ed80 Issue #26896: Disambiguate uses of "importer" with "finder".
Thanks to Oren Milman for the patch.
2016-07-08 11:00:00 -07:00
Łukasz Langa
34ad2ef8f9 Merge 3.5, issue #14209 2016-06-11 18:05:42 -07:00
Łukasz Langa
0d18c15fbf Issue #14209: pkgutil.iter_zipimport_modules ignores the prefix for packages
Patch by James Pickering.
2016-06-11 18:02:46 -07:00
Brett Cannon
c0d91aff9a Upgrade the imp module's deprecation to DeprecationWarning. 2015-10-16 12:21:37 -07:00
Brett Cannon
2a17bde930 Issue #20383: Introduce importlib.util.module_from_spec().
Along the way, dismantle importlib._bootstrap._SpecMethods as it was
no longer relevant and constructing the new function required
partially dismantling the class anyway.
2014-05-30 14:55:29 -04:00
Brett Cannon
8447c703d1 Issue #14710: Fix both pkgutil.find_loader() and get_loader() to not
raise an exception when a module doesn't exist.

Thanks to Pavel Aslanov for the bug report.
2014-05-23 12:30:37 -04:00
Eric Snow
658af31372 Issue #21200: Return None from pkgutil.get_loader() when __spec__ is missing. 2014-04-19 00:13:23 -06:00
Nick Coghlan
62b4b9eecb Close #20839: pkgutil.find_loader now uses importlib.util.find_spec 2014-03-04 20:39:42 +10:00
Eric Snow
6029e08691 Issue 19944: Fix importlib.find_spec() so it imports parents as needed.
The function is also moved to importlib.util.
2014-01-25 15:32:46 -07:00
Eric Snow
02b9f9d6bb Remove more usage of APIs deprecated by PEP 451. 2014-01-06 20:42:59 -07:00
Eric Snow
37148b27ac Issue #19708: Update pkgutil to use the new importer APIs. 2014-01-04 15:09:53 -07:00
Eric Snow
b523f8433a Implement PEP 451 (ModuleSpec). 2013-11-22 09:05:39 -07:00
Nick Coghlan
862542e500 Close #19409: add missing import in pkgutil 2013-10-27 00:27:39 +10:00
Brett Cannon
e4f41deccf Issue #17177: The imp module is pending deprecation.
To make sure there is no issue with code that is both Python 2 and 3
compatible, there are no plans to remove the module any sooner than
Python 4 (unless the community moves to Python 3 solidly before then).
2013-06-16 13:13:40 -04:00
Łukasz Langa
6f69251980 Add reference implementation for PEP 443
PEP accepted: http://mail.python.org/pipermail/python-dev/2013-June/126734.html
2013-06-05 12:20:24 +02:00
Nick Coghlan
685bd4a37a Merge fix for #16163 from 3.3 2013-04-14 23:01:11 +10:00
Nick Coghlan
c4e0d982f3 Close issue #16163: handle submodules in pkgutil.iter_importers 2013-04-14 22:30:42 +10:00