Commit Graph

114 Commits

Author SHA1 Message Date
Nick Coghlan 5b1fdc1e37 Issue #21669: Special case print & exec syntax errors 2014-06-16 19:48:02 +10:00
Victor Stinner 69598d4ccf Issue #21118: Fix _PyUnicodeTranslateError_Create(), add missing format
character for the "end" parameter
2014-04-04 20:59:44 +02:00
Benjamin Peterson 9b09ba1234 bail in unicode error's __str__ methods if the objects are not properly initialized (closes #21134) 2014-04-02 12:15:06 -04:00
Larry Hastings 8f9f0f12e8 Issue #20517: Removed unnecessary new (short-lived) functions from PyErr. 2014-02-10 03:43:57 -08: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
Nick Coghlan 77b286b2cc Close #20105: set __traceback__ when chaining exceptions in C 2014-01-27 00:53:38 +10:00
Christian Heimes af01f66817 Issue #16136: Remove VMS support and VMS-related code 2013-12-21 16:19:10 +01:00
Nick Coghlan f1de55fb33 Also chain codec exceptions that allow weakrefs
The zlib and hex codecs throw custom exception types with
weakref support if the input type is valid, but the data
fails validation. Make sure the exception chaining in the
codec infrastructure can wrap those as well.
2013-11-19 22:33:10 +10:00
Nick Coghlan 4b9b936429 Don't decref exc too soon 2013-11-16 00:34:13 +10:00
Victor Stinner 46ef31953e Issue #19429, #19437: fix error handling in the OSError constructor 2013-11-14 22:31:41 +01:00
Benjamin Peterson e109ee8205 fix refleaks 2013-11-13 23:49:49 -05:00
Benjamin Peterson 079c998872 adjust style 2013-11-13 23:25:01 -05:00
Christian Heimes 6a3db25c70 Issue #17828: _PyObject_GetDictPtr() may return NULL instead of a PyObject**
CID 1128792: Dereference null return value (NULL_RETURNS)
2013-11-14 01:47:14 +01:00
Christian Heimes 507eabdf11 Issue #17828: va_start() must be accompanied by va_end()
CID 1128793: Missing varargs init or cleanup (VARARGS)
2013-11-14 01:39:35 +01:00
Nick Coghlan 8b097b4ed7 Close #17828: better handling of codec errors
- output type errors now redirect users to the type-neutral
  convenience functions in the codecs module
- stateless errors that occur during encoding and decoding
  will now be automatically wrapped in exceptions that give
  the name of the codec involved
2013-11-13 23:49:21 +10:00
Serhiy Storchaka c679227e31 Issue #1772673: The type of `char*` arguments now changed to `const char*`. 2013-10-19 21:03:34 +03:00
Brett Cannon 679ecb565b Issue #15767: back out 8a0ed9f63c6e, finishing the removal of
ModuleNotFoundError.
2013-07-04 17:51:50 -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
Antoine Pitrou 7faf70512a Issue #17591: Use lowercase filenames when including Windows header files.
Patch by Roumen Petrov.
2013-03-31 22:48:04 +02:00
Richard Oudkerk 30147710e8 Issue #15784: Modify OSError.__str__() to better distinguish between
errno error numbers and Windows error numbers.
2012-08-28 19:33:26 +01:00
Brett Cannon 07c6e71689 Issue #15778: Coerce ImportError.args to a string when it isn't
already one.

Patch by Dave Malcolm.
2012-08-24 13:05:09 -04:00
Richard Oudkerk 5562d9dc5d Issue #1692335: Move initial args assignment to BaseException.__new__
to help pickling of naive subclasses.
2012-07-28 17:45:28 +01:00
Antoine Pitrou f87289bb58 Issue #15229: An OSError subclass whose __init__ doesn't call back
OSError.__init__ could produce incomplete instances, leading to crashes
when calling str() on them.
2012-06-30 23:37:47 +02:00
Nick Coghlan c40bc09942 Issue #13783: the PEP 380 implementation no longer expands the public C API 2012-06-17 15:15:49 +10:00
Antoine Pitrou 32bc80c523 Fix build failure. 2012-05-16 12:51:55 +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
Brian Curtin 401f9f3d32 Fix #13210. Port the Windows build from VS2008 to VS2010. 2012-05-13 11:19:23 -05:00
Brett Cannon fd0741555b Issue #2377: Make importlib the implementation of __import__().
importlib._bootstrap is now frozen into Python/importlib.h and stored
as _frozen_importlib in sys.modules. Py_Initialize() loads the frozen
code along with sys and imp and then uses _frozen_importlib._install()
to set builtins.__import__() w/ _frozen_importlib.__import__().
2012-04-14 14:10:13 -04: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
Nick Coghlan ab7bf2143e Close issue #6210: Implement PEP 409 2012-02-26 17:49:52 +10:00
Benjamin Peterson 23d7f12ffb use new generic __dict__ descriptor implementations 2012-02-19 20:02:57 -05:00
Benjamin Peterson 67e700697e merge 3.2 2012-02-10 08:47:04 -05:00
Benjamin Peterson efe7c9d4d7 this is only a borrowed ref in Brett's branch 2012-02-10 08:46:54 -05:00
Benjamin Peterson 9878b63c7c merge 3.2 2012-02-06 11:30:05 -05:00
Benjamin Peterson 2f9c71bbba bltinmod is borrowed, so it shouldn't be decrefed 2012-02-06 11:28:45 -05:00
Benjamin Peterson 951138c795 merge 3.2 2012-02-03 19:25:01 -05:00
Benjamin Peterson 90b13583bc put returns on their own lines 2012-02-03 19:22:31 -05:00
Antoine Pitrou ac456a1839 Fix some of the remaining test_capi leaks 2012-01-18 21:35:21 +01:00
Antoine Pitrou 8b0a74e936 Fix some of the remaining test_capi refleaks 2012-01-18 21:29:05 +01:00
Antoine Pitrou 84091bfa45 Fix some of the refleaks in test_capi (ported from 3.2) 2012-01-18 21:24:18 +01:00
Antoine Pitrou 55f217f22d Fix refleaks in test_capi
(this was easier than I thought!)
2012-01-18 21:23:13 +01:00
Antoine Pitrou bb5b92d324 Merge refleak fixes from 3.2 2012-01-18 16:19:19 +01:00
Antoine Pitrou 1c7ade5284 Fix leaking a RuntimeError objects when creating sub-interpreters 2012-01-18 16:13:31 +01:00
Nick Coghlan 1f7ce62bd6 Implement PEP 380 - 'yield from' (closes #11682) 2012-01-13 21:43:40 +10:00
Antoine Pitrou e0e2735f41 Fix OSError.__init__ and OSError.__new__ so that each of them can be
overriden and take additional arguments (followup to issue #12555).
2011-12-15 14:31:28 +01:00
Victor Stinner 9e30aa52fd Fix misuse of PyUnicode_GET_SIZE() => PyUnicode_GET_LENGTH()
And PyUnicode_GetSize() => PyUnicode_GetLength()
2011-11-21 02:49:52 +01:00
Victor Stinner 53b33e767d UnicodeTranslateError uses the new Unicode API
The index is a character index, not a index in a Py_UNICODE* string.
2011-11-21 01:17:27 +01:00
Victor Stinner da1ddf37c6 UnicodeEncodeError uses the new Unicode API
The index is a character index, not a index in a Py_UNICODE* string.
2011-11-20 22:50:23 +01:00
Martin v. Löwis b09af03b8a Port error handlers from Py_UNICODE indexing to code point indexing. 2011-11-04 11:16:41 +01:00
Antoine Pitrou 6b4883dec0 PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy. 2011-10-12 02:54:14 +02:00