Commit Graph

213 Commits

Author SHA1 Message Date
jdkandersson 9cbb97b29e bpo-37574: Mention helper functions for find_spec documentation (GH-14739) 2019-09-10 17:06:22 +01:00
Min ho Kim 39d87b5471 Fix typos mostly in comments, docs and test names (GH-15209) 2019-08-30 16:21:19 -04:00
Ngalim Siregar c5fa44944e bpo-37444: Update differing exception between builtins and importlib (GH-14869)
Imports now raise `TypeError` instead of `ValueError` for relative import failures. This makes things consistent between `builtins.__import__` and `importlib.__import__` as well as using a more natural import for the failure.


https://bugs.python.org/issue37444



Automerge-Triggered-By: @brettcannon
2019-08-02 22:46:02 -07:00
Tzu-ping Chung 544fa15ea1 Swap 'if' branches so content matches to condition in importlib example (GH-14947)
Prior to this change the guard on an 'elif' used an assignment expression whose value was used in a later 'else' block, causing some confusion for people.

(Discussion on Twitter: https://twitter.com/brettsky/status/1153861041068994566.)

Automerge-Triggered-By: @brettcannon
2019-07-25 10:20:33 -07:00
Brett Cannon 0827064c95 bpo-37521: No longer treat insertion into sys.modules as optional in importlib examples (GH-14723)
Fix importlib examples to insert any newly created modules via importlib.util.module_from_spec() immediately into sys.modules instead of after calling loader.exec_module().

Thanks to Benjamin Mintz for finding the bug.


https://bugs.python.org/issue37521
2019-07-12 15:35:34 -07:00
aldwinaldwin b607d992e7 bpo-37459: importlib docs improperly reference get_resource_loader() (#14568)
* bpo-37459: importlib docs improperly reference get_resource_loader()
2019-07-03 17:58:45 -07:00
Nick Coghlan cee29b46a1 bpo-35486: Note Py3.6 import system API requirement change (GH-11540)
While the introduction of ModuleNotFoundError was fully backwards
compatible on the import API consumer side, folks providing alternative
implementations of `__import__` need to make an update to be
forward compatible with clients that start relying on the new subclass.



https://bugs.python.org/issue35486
2019-01-17 02:41:29 -08:00
Serhiy Storchaka 2b57c43f21
bpo-35506: Remove redundant and incorrect links from keywords. (GH-11174) 2018-12-19 08:09:46 +02:00
E Kawashima 16c8a53490 [Docs] Fix required version of an example of importlib (GH-10118)
§31.5.6.3. Importing a source file directly: `module_from_spec` is new in Python 3.5.
2018-11-05 23:41:17 +01:00
Stéphane Wirtel e483f02423 bpo-35044, doc: Use the :exc: role for the exceptions (GH-10037) 2018-10-26 12:52:11 +02:00
orlnub123 78401f7156 importlib doc: Fix approximated import_module() code (GH-9945)
The spec gets stored on modules with the __spec__ attribute, not spec.
2018-10-25 01:32:26 +02:00
Andrés Delfino 65b5ef02ec Fix the versionadded indentation in exec_module doc (GH-8719) 2018-08-11 23:50:46 -07:00
Xtreak c151f7846d bpo-33859: Fix spelling mistakes in docs. (GH-7691) 2018-06-16 08:08:31 +03:00
Brett Cannon 3ab9365dca
bpo-33254: do not return an empty list when asking for the contents of a namespace package (GH-6467) 2018-04-30 11:31:45 -07:00
Brett Cannon 9e2be60634
bpo-33169: Remove values of `None` from sys.path_importer_cache when invalidating caches (GH-6402)
An entry of None in sys.path_importer_cache represents a negative/missing finder for a path, so clearing it out makes sense.
2018-04-06 16:10:18 -07:00
Himanshu Lakhara 5cbb84106e bpo-27428: Fix WindowsRegistryFinder documentation to list appropriate ABC (GH-6061) 2018-03-23 14:26:35 -07:00
Barry Warsaw 997b8c140e
Update and sync importlib.resources documentation (#5694) 2018-02-16 10:45:39 -05:00
Barry Warsaw bbbcf8693b
bpo-32303 - Consistency fixes for namespace loaders (#5481)
* Make sure ``__spec__.loader`` matches ``__loader__`` for namespace packages.
* Make sure ``__spec__.origin` matches ``__file__`` for namespace packages.

https://bugs.python.org/issue32303
https://bugs.python.org/issue32305
2018-02-02 15:15:58 -05:00
Brett Cannon bca42186b6
bpo-32248: Introduce the concept of Loader.get_resource_reader() (GH-5108) 2018-01-12 15:08:59 -08:00
Barry Warsaw deae6b451f
bpo-32248 - Implement importlib.resources (#4911)
Port importlib_resources to importlib.resources
2017-12-30 15:18:06 -05:00
Brett Cannon 4ac5150e06
bpo-32248: Implement importlib.abc.ResourceReader (GH-4892) 2017-12-15 16:29:35 -08: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
Barry Warsaw 191e313820 bpo-31799: Make module.__spec__ more discoverable (#4010)
bpo-31799: Make module.__spec__ more discoverable
2017-10-17 15:52:38 -04:00
Benjamin Peterson 60dbed1850 link to legacy doc on the non-legacy website (#3362) 2017-09-05 16:24:39 -07:00
Milan Oberkirch 8c3f05e9f0 bpo-30436: Raise ModuleNotFoundError for importlib.util.find_spec() when parent isn't a package (GH-1899)
Previously AttributeError was raised, but that's not very reflective of the fact that the requested module can't be found since the specified parent isn't actually a package.
2017-06-14 14:34:50 -07:00
Garvit Khatri 94987826e8 bpo-29851: Have importlib.reload() raise ImportError if the module's spec is not found (GH-972) 2017-05-24 15:19:50 -07:00
Steve Dower 20367420c8 Issue #28896: Deprecate WindowsRegistryFinder 2016-12-07 13:02:27 -08:00
Serhiy Storchaka e418432dfb Fixed double hyphens that are rendered to literal en-dashes in the documenation. 2016-12-04 10:22:09 +02:00
Serhiy Storchaka 29b0a26822 Fixed double hyphens that are rendered to literal en-dashes in the documenation. 2016-12-04 10:20:55 +02:00
Serhiy Storchaka 989db5c880 Issue #19795: Mark up None as literal text. 2016-10-19 16:37:13 +03:00
Serhiy Storchaka ecf41da83e Issue #19795: Mark up None as literal text. 2016-10-19 16:29:26 +03:00
Benjamin Peterson f7e2ea2f33 remove ungrammarical apostrophe (closes #27957) 2016-09-05 14:02:59 -07:00
Brett Cannon 2376316857 Issue #27853: Add section headers to the importlib example docs 2016-09-08 10:12:47 -07:00
Brett Cannon 035a100382 Issue #26667: Add path-like object support to importlib.util. 2016-09-07 18:39:18 -07:00
Benjamin Peterson 942dd9f3f7 merge 3.5 (#27957) 2016-09-05 14:03:08 -07:00
Martin Panter 8bde911115 Issue #27626: Merge spelling fixes from 3.5 2016-07-28 01:30:58 +00:00
Martin Panter eb9957065a Issue #27626: Spelling fixes in docs, comments and internal names
Based on patch by Ville Skyttä.
2016-07-28 01:11:04 +00:00
Brett Cannon 696c35e86b Issue #26186: Remove the restriction that built-in and extension
modules  can't be lazily loaded.

Thanks to Python 3.6 allowing for types.ModuleType to have its
__class__ mutated, the restriction can be lifted by calling
create_module() on the wrapped loader.
2016-06-25 10:58:17 -07:00
Terry Jan Reedy 58d3f59c2f Merge with 3.5 2016-06-22 22:46:51 -04:00
Terry Jan Reedy dcb6c88a24 Issue #27304: Source code links for sub-packages in the same file.
Patch by Yoni Lavi
2016-06-22 22:46:34 -04:00
Terry Jan Reedy 4da945f361 Merge Issue #22558. 2016-06-11 15:06:08 -04:00
Terry Jan Reedy fa089b9b0b Issue #22558: Add remaining doc links to source code for Python-coded modules.
Reformat header above separator line (added if missing) to a common format.
Patch by Yoni Lavi.
2016-06-11 15:02:54 -04:00
Eric Snow dc4f7c09cc Issue #27147: Mention PEP 420 in the importlib docs. 2016-05-28 11:08:20 -07:00
Eric Snow 338502b307 Issue #27147: Mention PEP 420 in the importlib docs. 2016-05-28 11:56:53 -06:00
Brett Cannon 5936313651 Issue #26252: Add an example on how to register a finder 2016-03-18 11:54:22 -07:00
Brett Cannon 86a8be00ed Fix a name in an example 2016-02-20 18:47:09 -08:00
Brett Cannon 4cbab346df Issue #26397: Update an importlib example to use util.module_from_spec() instead of create_module() 2016-02-20 18:45:56 -08:00
Brett Cannon fe1941ebf8 Merge w/ 3.5 2016-02-20 18:40:18 -08:00
Brett Cannon 27c712e149 List what classes from importlib.machinery don't work with importlib.util.LazyLoader 2016-02-20 18:40:02 -08:00
Berker Peksag 89e54338d0 Issue #26242: Fix another one in importlib.rst 2016-01-30 19:30:22 +02:00