Commit Graph

298 Commits

Author SHA1 Message Date
Victor Stinner 944fbcc478 Issue #23571: Enhance _Py_CheckFunctionResult()
Too bad, sometimes Py_FatalError() is unable to write the exception into
sys.stderr (on "AMD64 OpenIndiana 3.x" buildbot, the buildbot was probably out
of memory).

Call Py_FatalError() with a different message for the two cases (result+error,
or no result and no error).
2015-03-24 16:28:52 +01:00
Victor Stinner 3b06dfb9d1 Issue #23571: In debug mode, _Py_CheckFunctionResult() now calls
Py_FatalError() instead of using an assertion in debug mode. Py_FatalError()
displays the current exception and the traceback which contain more information
than just the assertion error.
2015-03-24 12:53:59 +01:00
Victor Stinner efde146b0c Issue #23571: _Py_CheckFunctionResult() now gives the name of the function
which returned an invalid result (result+error or no result without error) in
the exception message.

Add also unit test to check that the exception contains the name of the
function.

Special case: the final _PyEval_EvalFrameEx() check doesn't mention the
function since it didn't execute a single function but a whole frame.
2015-03-21 15:04:43 +01:00
Victor Stinner 283f3f8ab3 Issue #23571: Oops, fix #ifdef assert()
assert() are noop when NDEBUG is defined. We want the opposite.
2015-03-09 15:55:37 +01:00
Victor Stinner 4a7cc88472 Issue #23571: PyObject_Call(), PyCFunction_Call() and call_function() now
raise a SystemError if a function returns a result and raises an exception.
The SystemError is chained to the previous exception.

Refactor also PyObject_Call() and PyCFunction_Call() to make them more readable.

Remove some checks which became useless (duplicate checks).

Change reviewed by Serhiy Storchaka.
2015-03-06 23:35:27 +01:00
Stefan Krah 5178d91be0 Issue #14203: Remove obsolete support for view==NULL in PyBuffer_FillInfo()
and bytearray_getbuffer().  Both functions now raise BufferError in that
case.
2015-02-03 16:57:21 +01:00
Serhiy Storchaka 3dd3e26680 Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
and PyObject_AsWriteBuffer().
2015-02-03 01:25:42 +02:00
Serhiy Storchaka 4fdb68491e Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
and PyObject_AsWriteBuffer().
2015-02-03 01:21:08 +02:00
Stefan Krah 2e6658b4a7 Merge from 3.4. 2015-02-01 19:19:49 +01:00
Stefan Krah 7213fcc27e Issue #23370: Fix off-by-one error for non-contiguous buffers. 2015-02-01 16:19:23 +01:00
Stefan Krah 363af44a4a Issue #22445: PyBuffer_IsContiguous() now implements precise contiguity
tests, compatible with NumPy's NPY_RELAXED_STRIDES_CHECKING compilation
flag.  Previously the function reported false negatives for corner cases.
2015-02-01 14:53:54 +01:00
Ethan Furman b95b56150f Issue20284: Implement PEP461 2015-01-23 20:05:18 -08:00
R David Murray 861470c836 #16518: Bring error messages in harmony with docs ("bytes-like object")
Some time ago we changed the docs to consistently use the term 'bytes-like
object' in all the contexts where bytes, bytearray, memoryview, etc are used.
This patch (by Ezio Melotti) completes that work by changing the error
messages that previously reported that certain types did "not support the
buffer interface" to instead say that a bytes-like object is required.  (The
glossary entry for bytes-like object references the discussion of the buffer
protocol in the docs.)
2014-10-05 11:47:01 -04:00
Georg Brandl 72b8a80e59 Closes #22540: speed up PyObject_IsInstance and PyObject_IsSubclass in the common case that the second argument has metaclass "type". 2014-10-03 09:26:37 +02:00
Victor Stinner 8f4ec8d3ef Issue #22290: PyObject_Call() now fails with an assertion error when called
with an exception set. This new assertion helps to understand if the exception
was already set before calling the function or raised by the function.
2014-09-05 01:10:29 +02:00
Benjamin Peterson 3cbae68de6 merge 3.4 2014-06-26 23:29:19 -07:00
Benjamin Peterson 1791c224dd use NULL not 0 2014-06-26 23:29:13 -07:00
Benjamin Peterson d51374ed78 PEP 465: a dedicated infix operator for matrix multiplication (closes #21176) 2014-04-09 23:55:56 -04:00
Victor Stinner 4ac9c00cff Better assertion in PyObject_Call() to detect functions returning a result with
an exception set (invalid state).
2013-12-19 13:47:35 +01:00
Serhiy Storchaka c4f3212abc Issue #17576: Deprecation warning emitted now when __int__() or __index__()
return not int instance.  Introduced _PyLong_FromNbInt() and refactored
PyLong_As*() functions.
2013-12-11 21:26:36 +02:00
Serhiy Storchaka 31a655411a Issue #17576: Deprecation warning emitted now when __int__() or __index__()
return not int instance.  Introduced _PyLong_FromNbInt() and refactored
PyLong_As*() functions.
2013-12-11 21:07:54 +02:00
Victor Stinner 0b0c867178 Issue #19437: Fix PyObject_CallFunction(), handle Py_VaBuildValue() and
PyTuple_New() failure
2013-10-29 19:29:52 +01:00
Serhiy Storchaka f740d467bf Issue #19369: Optimized the usage of __length_hint__(). 2013-10-24 23:19:51 +03:00
Serhiy Storchaka c679227e31 Issue #1772673: The type of `char*` arguments now changed to `const char*`. 2013-10-19 21:03:34 +03:00
Serhiy Storchaka 46e1ce214b Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
2013-08-27 20:17:03 +03:00
Serhiy Storchaka 9594942716 Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
2013-08-27 19:40:23 +03:00
Serhiy Storchaka 579ddc2fd4 Issue #16741: Fix an error reporting in int(). 2013-08-03 21:14:05 +03:00
Serhiy Storchaka f6d0aeeadc Issue #16741: Fix an error reporting in int(). 2013-08-03 20:55:06 +03:00
Victor Stinner f243ee4055 Issue #18408: add more assertions on PyErr_Occurred() in ceval.c to detect bugs
earlier
2013-07-16 01:02:12 +02:00
Victor Stinner 3de5869864 Issue #18408: PyObject_Call() now fails with an assertion error in debug mode
if the function called failed whereas no exception was raised, to detect bugs
earlier.
2013-07-15 17:50:07 +02:00
Victor Stinner 0e2d3cf2cb Issue #18203: Replace malloc() with PyMem_Malloc() in _PySequence_BytesToCharpArray() 2013-07-07 17:22:41 +02:00
Serhiy Storchaka 1cfebc73e0 Issue #9369: The types of `char*` arguments of PyObject_CallFunction() and
PyObject_CallMethod() now changed to `const char*`.
Based on patches by Jörg Müller and Lars Buitinck.
2013-05-29 18:50:54 +03:00
Alexandre Vassalotti 865eaa1b53 Closes #17892: Fix the name of _PyObject_CallMethodObjIdArgs 2013-05-02 10:44:04 -07:00
Mark Dickinson 93196eb44f Issue #17715: Merge fix from 3.3. 2013-04-13 17:46:04 +01:00
Mark Dickinson c9734484ca Issue #17715: Add missing NULL Check to PyNumber_Long. 2013-04-13 17:44:44 +01:00
Serhiy Storchaka ee57f159af Revert a premature patch for issue #14010 (changeset 846bd418aee5). 2013-04-06 22:55:12 +03:00
Serhiy Storchaka 278d03bd66 Revert a premature patch for issue #14010 (changeset aaaf36026511). 2013-04-06 22:52:34 +03:00
Serhiy Storchaka aac81e2780 Issue #14010: Fix a crash when iterating or deleting deeply nested filters
(builting and in itertools module, i.e. map(), itertools.chain(), etc).
2013-04-06 21:20:30 +03:00
Serhiy Storchaka e8f706eda7 Issue #14010: Fix a crash when iterating or deleting deeply nested filters
(builting and in itertools module, i.e. map(), itertools.chain(), etc).
2013-04-06 21:14:43 +03:00
Armin Ronacher 74b38b190f Issue #16148: Small improvements and cleanup. Added version information
to docs.
2012-10-07 10:29:32 +02:00
Christian Heimes b70e8a1958 and another one 2012-10-06 17:16:39 +02:00
Christian Heimes 6314d164c9 move var declaration to top of block to fix compilation on Windows, fixes a7ec0a1b0f7c 2012-10-06 17:13:29 +02:00
Armin Ronacher aa9a79d279 Issue #16148: implemented PEP 424 2012-10-06 14:03:24 +02:00
Mark Dickinson 3d7838593b Issue #16060: Fix a double DECREF in int() implementation. Thanks Serhiy Storchaka. 2012-09-27 19:38:59 +01:00
Stefan Krah 5b27c53e36 Merge 3.2. 2012-08-21 08:25:41 +02:00
Stefan Krah 7cacd2eb92 Issue #15736: Fix overflow in _PySequence_BytesToCharpArray(). 2012-08-21 08:16:09 +02:00
Stefan Krah 6adf2433e4 Merge 3.2. 2012-08-20 11:13:58 +02:00
Stefan Krah fd24f9e51e Issue #15732: Fix (constructed) crash in _PySequence_BytesToCharpArray().
Found by Coverity.
2012-08-20 11:04:24 +02:00
Stefan Krah 7d12d9df13 Issue #12834: Fix PyBuffer_ToContiguous() for non-contiguous arrays. 2012-07-28 12:25:55 +02: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