summaryrefslogtreecommitdiff
path: root/Objects/abstract.c
Commit message (Collapse)AuthorAgeFilesLines
...
* PyObject_CallMethodObjArgs() now uses fast callVictor Stinner2016-08-241-32/+71
| | | | | | | | | | | | | | | | | | | Issue #27809: * PyObject_CallMethodObjArgs(), _PyObject_CallMethodIdObjArgs() and PyObject_CallFunctionObjArgs() now use fast call to avoid the creation of a temporary tuple * Rename objargs_mktuple() to objargs_mkstack() * objargs_mkstack() now stores objects in a C array using borrowed references, instead of storing arguments into a tuple objargs_mkstack() uses a small buffer allocated on the C stack for 5 arguments or less, or allocates a buffer in the heap memory. Note: this change is different than the change 0e4f26083bbb, I fixed the test to decide if the small stack can be used or not. sizeof(PyObject**) was also replaced with sizeof(stack[0]) since the sizeof() was wrong (but gave the same result).
* Backed out changeset 0e4f26083bbb (PyObject_CallMethodObjArgs)Victor Stinner2016-08-241-71/+32
|
* PyObject_CallMethodObjArgs() now uses fast callVictor Stinner2016-08-241-32/+71
| | | | | | | | | | | | | | Issue #27809: * PyObject_CallMethodObjArgs(), _PyObject_CallMethodIdObjArgs() and PyObject_CallFunctionObjArgs() now use fast call to avoid the creation of a temporary tuple * Rename objargs_mktuple() to objargs_mkstack() * objargs_mkstack() now stores objects in a C array using borrowed references, instead of storing arguments into a tuple objargs_mkstack() uses a small buffer allocated on the C stack for 5 arguments or less, or allocates a buffer in the heap memory.
* _PyFunction_FastCallDict() supports keyword argsVictor Stinner2016-08-221-6/+5
| | | | | | | | Issue #27809: * Rename _PyFunction_FastCall() to _PyFunction_FastCallDict() * Rename _PyCFunction_FastCall() to _PyCFunction_FastCallDict() * _PyFunction_FastCallDict() now supports keyword arguments
* Rename _PyObject_FastCall() to _PyObject_FastCallDict()Victor Stinner2016-08-221-6/+6
| | | | | | | | Issue #27809: * Rename _PyObject_FastCall() function to _PyObject_FastCallDict() * Add _PyObject_FastCall(), _PyObject_CallNoArg() and _PyObject_CallArg1() macros calling _PyObject_FastCallDict()
* Issue #26984: int() now always returns an instance of exact int.Serhiy Storchaka2016-08-211-12/+23
|
* Fix PyObject_Call() parameter namesVictor Stinner2016-08-191-2/+4
| | | | | | Issue #27128: arg=>args, kw=>kwargs. Same change for PyEval_CallObjectWithKeywords().
* Avoid call_function_tail() for empty format strVictor Stinner2016-08-191-20/+19
| | | | | | Issue #27128, PyObject_CallFunction(), _PyObject_FastCall() and callmethod(): if the format string of parameters is empty, avoid the creation of an empty tuple: call _PyObject_FastCall() without parameters.
* PEP 7: add {...} around null_error() in abstract.cVictor Stinner2016-08-191-28/+65
| | | | Issue #27128.
* Cleanup callmethod()Victor Stinner2016-08-191-2/+6
| | | | | | | Make callmethod() less weird: don't decrement func reference counter, the caller is now responsible to do that. Issue #27128.
* Cleanup call_function_tail()Victor Stinner2016-08-191-20/+29
| | | | | | | | Make call_function_tail() less weird: don't decrement args reference counter, the caller is now responsible to do that. The caller now also checks if args is NULL. Issue #27128.
* call_function_tail() uses fast callVictor Stinner2016-08-191-13/+6
| | | | | | | | | | | Issue #27128: Modify call_function_tail() to use _PyObject_FastCall() when args is not a tuple to avoid the creation of a temporary tuple. call_function_tail() is used by: * PyObject_CallFunction() * PyObject_CallMethod() * _PyObject_CallMethodId()
* Add _PyObject_FastCall()Victor Stinner2016-08-191-0/+76
| | | | | | | | | | | | | | | | | Issue #27128: Add _PyObject_FastCall(), a new calling convention avoiding a temporary tuple to pass positional parameters in most cases, but create a temporary tuple if needed (ex: for the tp_call slot). The API is prepared to support keyword parameters, but the full implementation will come later (_PyFunction_FastCall() doesn't support keyword parameters yet). Add also: * _PyStack_AsTuple() helper function: convert a "stack" of parameters to a tuple. * _PyCFunction_FastCall(): fast call implementation for C functions * _PyFunction_FastCall(): fast call implementation for Python functions
* Issue #27581: Merge overflow fix from 3.5Martin Panter2016-07-251-4/+5
|\
| * Issue #27581: Don’t rely on overflow wrapping in PySequence_Tuple()Martin Panter2016-07-251-4/+5
| | | | | | | | Patch by Xiang Zhang.
* | Merge spelling fixes from 3.5Martin Panter2016-06-201-1/+1
|\ \ | |/
| * Fix spelling errors in code commentsMartin Panter2016-06-201-2/+2
| |
* | Comment fixes extracted from patch by Demur Rumed.Serhiy Storchaka2016-06-121-1/+1
| |
* | Issue #26983: float() now always return an instance of exact float.Serhiy Storchaka2016-06-031-6/+24
| | | | | | | | | | | | The deprecation warning is emitted if __float__ returns an instance of a strict subclass of float. In a future versions of Python this can be an error.
* | Issue #24802: Merge null termination fixes from 3.5Martin Panter2015-11-071-2/+20
|\ \ | |/
| * Issue #24802: Merge null termination fixes from 3.4 into 3.5Martin Panter2015-11-071-2/+20
| |\
| | * Issue #24802: Copy bytes-like objects to null-terminated buffers if necessaryMartin Panter2015-11-071-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | This avoids possible buffer overreads when int(), float(), compile(), exec() and eval() are passed bytes-like objects. Similar code is removed from the complex() constructor, where it was not reachable. Patch by John Leitch, Serhiy Storchaka and Martin Panter.
* | | Issue #25556: Add assertions to PyObject_GetItem() to ensure that an exceptionVictor Stinner2015-11-051-3/+8
|/ / | | | | | | | | | | | | is raised when it returns NULL. Simplify also ceval.c: rely on the fact that PyObject_GetItem() raised an exception when it returns NULL.
* | Issue #25523: Merge "a" to "an" fixes from 3.4 into 3.5Martin Panter2015-11-021-1/+1
|\ \ | |/
| * Issue #25523: Correct "a" article to "an" articleMartin Panter2015-11-021-1/+1
| | | | | | | | | | | | This changes the main documentation, doc strings, source code comments, and a couple error messages in the test suite. In some cases the word was removed or edited some other way to fix the grammar.
* | More typos in 3.5 documentation and commentsMartin Panter2015-10-071-1/+1
| |
* | mergeRaymond Hettinger2015-05-171-1/+1
|\ \ | |/
| * Issue #23757: Only call the concrete list API for exact lists.Raymond Hettinger2015-05-171-1/+1
| |
* | Issue #23571: Enhance _Py_CheckFunctionResult()Victor Stinner2015-03-241-9/+10
| | | | | | | | | | | | | | | | | | 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).
* | Issue #23571: In debug mode, _Py_CheckFunctionResult() now callsVictor Stinner2015-03-241-12/+9
| | | | | | | | | | | | 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.
* | Issue #23571: _Py_CheckFunctionResult() now gives the name of the functionVictor Stinner2015-03-211-6/+20
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Issue #23571: Oops, fix #ifdef assert()Victor Stinner2015-03-091-1/+1
| | | | | | | | assert() are noop when NDEBUG is defined. We want the opposite.
* | Issue #23571: PyObject_Call(), PyCFunction_Call() and call_function() nowVictor Stinner2015-03-061-20/+53
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Issue #14203: Remove obsolete support for view==NULL in PyBuffer_FillInfo()Stefan Krah2015-02-031-1/+6
| | | | | | | | | | and bytearray_getbuffer(). Both functions now raise BufferError in that case.
* | Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()Serhiy Storchaka2015-02-031-53/+27
|\ \ | |/ | | | | and PyObject_AsWriteBuffer().
| * Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()Serhiy Storchaka2015-02-031-54/+27
| | | | | | | | and PyObject_AsWriteBuffer().
* | Merge from 3.4.Stefan Krah2015-02-011-2/+2
|\ \ | |/
| * Issue #23370: Fix off-by-one error for non-contiguous buffers.Stefan Krah2015-02-011-2/+2
| |
* | Issue #22445: PyBuffer_IsContiguous() now implements precise contiguityStefan Krah2015-02-011-12/+37
| | | | | | | | | | tests, compatible with NumPy's NPY_RELAXED_STRIDES_CHECKING compilation flag. Previously the function reported false negatives for corner cases.
* | Issue20284: Implement PEP461Ethan Furman2015-01-231-2/+3
| |
* | #16518: Bring error messages in harmony with docs ("bytes-like object")R David Murray2014-10-051-7/+6
| | | | | | | | | | | | | | | | | | | | 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.)
* | Closes #22540: speed up PyObject_IsInstance and PyObject_IsSubclass in the ↵Georg Brandl2014-10-031-0/+15
| | | | | | | | common case that the second argument has metaclass "type".
* | Issue #22290: PyObject_Call() now fails with an assertion error when calledVictor Stinner2014-09-051-0/+5
| | | | | | | | | | 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.
* | merge 3.4Benjamin Peterson2014-06-261-9/+6
|\ \ | |/
| * use NULL not 0Benjamin Peterson2014-06-261-9/+6
| |
* | PEP 465: a dedicated infix operator for matrix multiplication (closes #21176)Benjamin Peterson2014-04-091-0/+14
|/
* Better assertion in PyObject_Call() to detect functions returning a result withVictor Stinner2013-12-191-1/+2
| | | | an exception set (invalid state).
* Issue #17576: Deprecation warning emitted now when __int__() or __index__()Serhiy Storchaka2013-12-111-56/+36
|\ | | | | | | | | return not int instance. Introduced _PyLong_FromNbInt() and refactored PyLong_As*() functions.
| * Issue #17576: Deprecation warning emitted now when __int__() or __index__()Serhiy Storchaka2013-12-111-56/+36
| | | | | | | | | | return not int instance. Introduced _PyLong_FromNbInt() and refactored PyLong_As*() functions.
* | Issue #19437: Fix PyObject_CallFunction(), handle Py_VaBuildValue() andVictor Stinner2013-10-291-0/+2
| | | | | | | | PyTuple_New() failure