Commit Graph

13 Commits

Author SHA1 Message Date
Brett Cannon 8f5ac5106e Issue #15767: Touch up ModuleNotFoundError usage by import.
Forgot to raise ModuleNotFoundError when None is found in sys.modules.
This led to introducing the C function PyErr_SetImportErrorSubclass()
to make setting ModuleNotFoundError easier.

Also updated the reference docs to mention ModuleNotFoundError
appropriately. Updated the docs for ModuleNotFoundError to mention the
None in sys.modules case.

Lastly, it was noticed that PyErr_SetImportError() was not setting an
exception when returning None in one case. That issue is now fixed.
2013-06-12 23:29:18 -04:00
Brett Cannon b961955e95 merge 2013-05-25 11:33:13 -04:00
Brett Cannon 4b4e38e7d4 Mention __cached__ in the import ref. 2013-05-25 11:32:50 -04:00
Brett Cannon 4c14b5de1c #17115,17116: Have modules initialize the __package__ and __loader__
attributes to None.

The long-term goal is for people to be able to rely on these
attributes existing and checking for None to see if they have been
set. Since import itself sets these attributes when a loader does not
the only instances when the attributes are None are from someone
overloading __import__() and not using a loader or someone creating a
module from scratch.

This patch also unifies module initialization. Before you could have
different attributes with default values depending on how the module
object was created. Now the only way to not get the same default set
of attributes is to circumvent initialization by calling
ModuleType.__new__() directly.
2013-05-04 13:56:58 -04:00
Georg Brandl 1bab7134a8 Merge with 3.3. 2013-03-28 13:28:55 +01:00
Georg Brandl 44ea77bd81 Closes #4159: add LaTeX tabular column specifications to tables that otherwise are cut off or have overlapping text. 2013-03-28 13:28:44 +01:00
Brett Cannon 4802becb16 Issue #17117: Have both import itself and importlib.util.set_loader()
set __loader__ on a module when set to None.

Thanks to Gökcen Eraslan for the fix.
2013-03-13 10:41:36 -07:00
Barry Warsaw 82c1c781c7 - Issue #16514: Fix regression causing a traceback when sys.path[0] is None
(actually, any non-string or non-bytes type).
2012-11-20 15:22:51 -05:00
Andrew Svetlov e2cf03e499 Issue #16144: Fix misleading sentence in reference/import.
Patch by Manuel Pégourié-Gonnard
2012-11-15 16:28:21 +02:00
Nick Coghlan 1685db011d s/path importer/path based finder/ (because the path based finder is not an importer and the simpler 'path finder' is too ambiguous) 2012-08-20 13:49:08 +10:00
Georg Brandl a81b481e3a Fix markup errors and update pydoc topics. 2012-08-11 08:43:59 +02:00
Nick Coghlan 4941774f59 Issue #15502: Bring the importlib.PathFinder docs and docstring more in line with the new import system documentation, and fix various parts of the new docs that weren't quite right given PEP 420 or were otherwise a bit misleading. Also note the key terminology problem still being discussed in the issue 2012-08-02 23:03:58 +10:00
Barry Warsaw dadebab42c Finally, a coherent set of terminology for all the lil' beasties involved. 2012-07-31 16:03:09 -04:00