Commit Graph

85 Commits

Author SHA1 Message Date
Eric Snow c943265ba5 Issue #15767: Add ModuleNotFoundError. 2016-09-07 15:42:32 -07:00
Ethan Furman 20bd9f033a Clarify NotImplemented vs NotImplementedError. Initial patch by Emmanuel Barry. Closes issue 27242. 2016-08-05 15:10:16 -07:00
Berker Peksag 8fafc74d45 Fix typos in mock and exceptions docs
The default value of __len__ is 0, not 1:

    >>> from unittest.mock import MagicMock
    >>> mock = MagicMock()
    >>> len(mock)
    0

Reported by Alex on docs@p.o.

Remove the remaining VMSError reference. VMS support is gone.
2016-04-11 12:23:04 +03:00
Martin Panter 084b368825 Issue #23391: Merge OSError doc from 3.4 into 3.5 2015-10-26 23:35:07 +00:00
Martin Panter 5487c13e44 Issue #23391: Restore OSError constructor argument documentation
This restores details lost in revision 097f4fda61a4 (since Python 3.3,
related to the new OSError subclasses). Further additions:

* Markup for attributes and constructor signature
* Explain "winerror" and "filename2"
* Extend test to check for filename2 defaulting to None
* Clarify that the constructor can return a subclass

I have intentionally left out any details of allowing more than five
arguments, or how the "args" attribute is set for four or more arguments.
These details seem to be dependent on the Python version and platform.
2015-10-26 11:05:42 +00:00
Martin Panter 84835ab1cb Issue #25161: Merge full stops from 3.4 into 3.5 2015-10-10 10:44:25 +00:00
Martin Panter d21e0b52f1 Issue #25161: Add full stops in documentation; patch by Takase Arihiro 2015-10-10 10:36:22 +00:00
Yury Selivanov f488fb422a Issue #19235: Add new RecursionError exception. Patch by Georg Brandl. 2015-07-03 01:04:23 -04:00
Yury Selivanov 66f8828bfc Issue #24439: Improve PEP 492 related docs.
Patch by Martin Panter.
2015-06-24 11:04:15 -04:00
Yury Selivanov a18cad543f Issue 24180: Fixes by Berker Peksag. 2015-05-21 17:02:31 -04:00
Yury Selivanov f3e40fac10 Issue 24180: Documentation for PEP 492 changes. 2015-05-21 11:50:30 -04:00
Yury Selivanov 8170e8c0d1 PEP 479: Change StopIteration handling inside generators.
Closes issue #22906.
2015-05-09 11:44:30 -04:00
Victor Stinner f70e1ca0fc Issue #23485: select.select() is now retried automatically with the recomputed
timeout when interrupted by a signal, except if the signal handler raises an
exception. This change is part of the PEP 475.

The asyncore and selectors module doesn't catch the InterruptedError exception
anymore when calling select.select(), since this function should not raise
InterruptedError anymore.
2015-03-30 21:16:11 +02:00
Berker Peksag 77a6b20a35 Issue #23432: Remove duplicate content from SystemExit docs.
Also, document SystemExit.code attribute explicitly.
2015-03-10 14:47:15 +02:00
Georg Brandl e4196d3f2e #22613: fix several factual errors in builtin docs (thanks Jacques Ducasse) 2014-10-31 09:41:46 +01:00
Terry Jan Reedy b6d1f48c14 Issue #21559: Add alternative (historical) reason for OverflowError. 2014-06-16 03:31:00 -04:00
Victor Stinner b2788fe854 Issue #16136: VMSError is done, bye bye VMS 2014-06-13 14:58:48 +02:00
Mark Dickinson abf079de25 Issue #20624: Exception docs wording tweak - clarify that it's okay to inherit from a subclass of Exception. 2014-04-14 11:20:12 -04:00
Benjamin Peterson 222ef82827 fix verb (closes #21174) 2014-04-07 19:34:33 -04:00
Andrew Svetlov 5898d4f4d9 IOError -> OSError 2014-04-01 00:44:13 +03:00
Larry Hastings 3732ed2414 Merge in all documentation changes since branching 3.4.0rc1. 2014-03-15 21:13:56 -07:00
Larry Hastings b082731fbb Issue #20517: Functions in the os module that accept two filenames
now register both filenames in the exception on failure.
This required adding new C API functions allowing OSError exceptions
to reference two filenames instead of one.
2014-02-09 22:05:19 -08:00
Antoine Pitrou c7cf5fca7c Issue #19691: remove outdated mention about RuntimeError 2013-11-25 19:11:07 +01:00
Antoine Pitrou 9527f16bf4 Issue #19691: remove outdated mention about RuntimeError 2013-11-25 19:08:32 +01:00
Serhiy Storchaka 98b28fddd8 Issue #18758: Fixed and improved cross-references. 2013-10-13 23:12:09 +03:00
Serhiy Storchaka bfdcd436f0 Issue #18758: Fixed and improved cross-references. 2013-10-13 23:09:14 +03:00
Georg Brandl bc332a2415 merge with 3.3 2013-10-08 21:43:46 +02:00
Georg Brandl f24c1416eb Fix wrong link. 2013-10-08 21:43:39 +02:00
Brett Cannon 679ecb565b Issue #15767: back out 8a0ed9f63c6e, finishing the removal of
ModuleNotFoundError.
2013-07-04 17:51:50 -04:00
Brett Cannon 82da8886cc Issue #15767: Revert 3a50025f1900 for ModuleNotFoundError 2013-07-04 17:48:16 -04:00
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 b1611e2772 Issue #15767: Introduce ModuleNotFoundError, a subclass of
ImportError.

The exception is raised by import when a module could not be found.
Technically this is defined as no viable loader could be found for the
specified module. This includes ``from ... import`` statements so that
the module usage is consistent for all situations where import
couldn't find what was requested.

This should allow for the common idiom of::

  try:
    import something
  except ImportError:
    pass

to be updated to using ModuleNotFoundError and not accidentally mask
ImportError messages that should propagate (e.g. issues with a
loader).

This work was driven by the fact that the ``from ... import``
statement needed to be able to tell the difference between an
ImportError that simply couldn't find a module (and thus silence the
exception so that ceval can raise it) and an ImportError that
represented an actual problem.
2013-06-12 16:59:46 -04:00
Nick Coghlan b4b8f234d4 Merge from 3.3 (issue #15209) 2012-12-09 16:22:17 +10:00
Nick Coghlan 0eee97cce6 Issue #15209: Fix typo and some additional wording tweaks 2012-12-09 16:21:46 +10:00
Nick Coghlan 10cdf99a90 Merge from 3.3 (Issue #15209) 2012-12-08 22:24:23 +10:00
Nick Coghlan 8e18fc8c0b Issue #15209: Clarify exception chaining description
- not allowed when implicitly re-raised the current exception
- last exception raised is always displayed last
- attempt to make it clearer when/if cause and context are shown
2012-12-08 21:39:24 +10:00
Andrew Svetlov b1715ea435 Merge 3.3 2012-12-05 11:12:50 +02:00
Andrew Svetlov 73a5a12dcf Fix typo. 2012-12-05 11:12:14 +02:00
Benjamin Peterson c77dd20698 merge 3.3 2012-12-02 11:33:14 -05:00
Benjamin Peterson 78f7e3a8dc document UnicodeError attributes 2012-12-02 11:33:06 -05:00
Victor Stinner 292c835548 Issue #15478: Raising an OSError doesn't decode or encode the filename anymore
Pass the original filename argument to OSError constructor, instead of trying
to encode it to or decode it from the filesystem encoding. This change avoids
an additionnal UnicodeDecodeError on Windows if the filename cannot be decoded
from the filesystem encoding (ANSI code page).
2012-10-30 02:17:38 +01:00
Ezio Melotti b24d3cf769 Fix indentation (or Sphinx will think these are attributes of ConnectionError). 2012-10-21 03:22:05 +03:00
Ezio Melotti 1dd7c30419 Merge __next__ method link fixes with 3.2. 2012-10-12 13:45:38 +03:00
Ezio Melotti 7fa822275b Fix links to the __next__ method. 2012-10-12 13:42:08 +03:00
Georg Brandl b8f2d29ea9 Remove attribution; this is for the whatsnew. 2012-06-24 13:06:44 +02:00
Benjamin Peterson d5a1c44455 PEP 415: Implement suppression of __context__ display with an exception attribute
This replaces the original PEP 409 implementation. See #14133.
2012-05-14 22:09:31 -07:00
Brett Cannon 79ec55e980 Issue #1559549: Add 'name' and 'path' attributes to ImportError.
Currently import does not use these attributes as they are planned
for use by importlib (which will be another commit).

Thanks to Filip Gruszczyński for the initial patch and Brian Curtin
for refining it.
2012-04-12 20:24:54 -04:00
Benjamin Peterson ad8586d075 typo 2012-02-27 10:59:10 -05:00
Nick Coghlan ab7bf2143e Close issue #6210: Implement PEP 409 2012-02-26 17:49:52 +10:00
Nick Coghlan 0ed8019c20 Add versionchanged notes for PEP 380 2012-01-14 14:43:24 +10:00