summaryrefslogtreecommitdiffstats
path: root/Objects/listobject.c
Commit message (Collapse)AuthorAgeFilesLines
* Make PyXXX_Fini() functions private (GH-15531)Victor Stinner2019-08-261-1/+1
| | | | | For example, rename PyTuple_Fini() to _PyTuple_Fini(). These functions are only declared in the internal C API.
* bpo-37648: Fixed minor inconsistency in some __contains__. (GH-14904)Serhiy Storchaka2019-08-041-2/+1
| | | | | The collection's item is now always at the left and the needle is on the right of ==.
* bpo-37483: add _PyObject_CallOneArg() function (#14558)Jeroen Demeyer2019-07-041-2/+1
|
* Improve docstring of list.sort (GH-8516)Tim Hoffmann2019-06-011-2/+10
|
* bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer2019-05-311-6/+6
| | | | | | | | | (GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
* bpo-36763: Implement the PEP 587 (GH-13592)Victor Stinner2019-05-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add a whole new documentation page: "Python Initialization Configuration" * PyWideStringList_Append() return type is now PyStatus, instead of int * PyInterpreterState_New() now calls PyConfig_Clear() if PyConfig_InitPythonConfig() fails. * Rename files: * Python/coreconfig.c => Python/initconfig.c * Include/cpython/coreconfig.h => Include/cpython/initconfig.h * Include/internal/: pycore_coreconfig.h => pycore_initconfig.h * Rename structures * _PyCoreConfig => PyConfig * _PyPreConfig => PyPreConfig * _PyInitError => PyStatus * _PyWstrList => PyWideStringList * Rename PyConfig fields: * use_module_search_paths => module_search_paths_set * module_search_path_env => pythonpath_env * Rename PyStatus field: _func => func * PyInterpreterState: rename core_config field to config * Rename macros and functions: * _PyCoreConfig_SetArgv() => PyConfig_SetBytesArgv() * _PyCoreConfig_SetWideArgv() => PyConfig_SetArgv() * _PyCoreConfig_DecodeLocale() => PyConfig_SetBytesString() * _PyInitError_Failed() => PyStatus_Exception() * _Py_INIT_ERROR_TYPE_xxx enums => _PyStatus_TYPE_xxx * _Py_UnixMain() => Py_BytesMain() * _Py_ExitInitError() => Py_ExitStatusException() * _Py_PreInitializeFromArgs() => Py_PreInitializeFromBytesArgs() * _Py_PreInitializeFromWideArgs() => Py_PreInitializeFromArgs() * _Py_PreInitialize() => Py_PreInitialize() * _Py_RunMain() => Py_RunMain() * _Py_InitializeFromConfig() => Py_InitializeFromConfig() * _Py_INIT_XXX() => _PyStatus_XXX() * _Py_INIT_FAILED() => _PyStatus_EXCEPTION() * Rename 'err' PyStatus variables to 'status' * Convert RUN_CODE() macro to config_run_code() static inline function * Remove functions: * _Py_InitializeFromArgs() * _Py_InitializeFromWideArgs() * _PyInterpreterState_GetCoreConfig()
* bpo-35091: Objects/listobject.c: Replace overflow checks in gallop fu… ↵Alexey Izbyshev2019-05-231-8/+4
| | | | | | | | | | | | | | | | (GH-10202) …nctions with asserts The actual overflow can never happen because of the following: * The size of a list can't be greater than PY_SSIZE_T_MAX / sizeof(PyObject*). * The size of a pointer on all supported plaftorms is at least 4 bytes. * ofs is positive and less than the list size at the beginning of each iteration. https://bugs.python.org/issue35091
* bpo-35983: skip trashcan for subclasses (GH-11841)Jeroen Demeyer2019-05-101-2/+2
| | | | | Add new trashcan macros to deal with a double deallocation that could occur when the `tp_dealloc` of a subclass calls the `tp_dealloc` of a base class and that base class uses the trashcan mechanism. Patch by Jeroen Demeyer.
* bpo-36218: Fix handling of heterogeneous values in list.sort (GH-12209)Rémi Lapeyre2019-03-251-11/+22
|
* bpo-36030: Add _PyTuple_FromArray() function (GH-11954)Sergey Fedoseev2019-02-251-16/+2
|
* bpo-33989: Ensure that ms.key_compare is always initialized in ↵Zackery Spytz2019-02-211-0/+3
| | | | list_sort_impl(). (GH-8710)
* bpo-36062: Minor speed-up for list slicing and copying. (GH-11967)Sergey Fedoseev2019-02-211-8/+12
|
* closes bpo-35623: Fix integer overflow when sorting large lists (GH-11380)sth2019-01-021-1/+0
| | | | | There is already a `Py_ssize_t i` defined at function scope that is used for similar loops. By removing the local `int i` declaration that `i` is used, which has the appropriate type.
* bpo-33234: Simplify list_preallocate_exact() (GH-11220)Sergey Fedoseev2018-12-291-14/+3
|
* bpo-35444: Unify and optimize the helper for getting a builtin object. ↵Serhiy Storchaka2018-12-111-3/+5
| | | | | | | | (GH-11047) This speeds up pickling of some iterators. This fixes also error handling in pickling methods when fail to look up builtin "getattr".
* bpo-35081: Add Include/internal/pycore_object.h (GH-10640)Victor Stinner2018-11-211-0/+1
| | | | Move _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() from Include/objimpl.h to Include/internal/pycore_object.h.
* bpo-35081: Rename internal headers (GH-10275)Victor Stinner2018-11-121-1/+1
| | | | | | | | | | | | | | Rename Include/internal/ headers: * pycore_hash.h -> pycore_pyhash.h * pycore_lifecycle.h -> pycore_pylifecycle.h * pycore_mem.h -> pycore_pymem.h * pycore_state.h -> pycore_pystate.h Add missing headers to Makefile.pre.in and PCbuild: * pycore_condvar.h. * pycore_hamt.h * pycore_pyhash.h
* bpo-35081: Move accu.h to Include/internal/pycore_accu.h (GH-10271)Victor Stinner2018-11-011-1/+1
| | | | | | | The accu.h header is no longer part of the Python C API: it has been moved to the "internal" headers which are restricted to Python itself. Replace #include "accu.h" with #include "pycore_accu.h".
* bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner2018-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | * Rename Include/internal/ header files: * pyatomic.h -> pycore_atomic.h * ceval.h -> pycore_ceval.h * condvar.h -> pycore_condvar.h * context.h -> pycore_context.h * pygetopt.h -> pycore_getopt.h * gil.h -> pycore_gil.h * hamt.h -> pycore_hamt.h * hash.h -> pycore_hash.h * mem.h -> pycore_mem.h * pystate.h -> pycore_state.h * warnings.h -> pycore_warnings.h * PCbuild project, Makefile.pre.in, Modules/Setup: add the Include/internal/ directory to the search paths of header files. * Update includes. For example, replace #include "internal/mem.h" with #include "pycore_mem.h".
* bpo-33234 Improve list() pre-sizing for inputs with known lengths (GH-9846)Pablo Galindo2018-10-281-0/+40
| | | | | | | | | | | | The list() constructor isn't taking full advantage of known input lengths or length hints. This commit makes the constructor pre-size and not over-allocate when the input size is known (the input collection implements __len__). One on the main advantages is that this provides 12% difference in memory savings due to the difference between overallocating and allocating exactly the input size. For efficiency purposes and to avoid a performance regression for small generators and collections, the size of the input object is calculated using __len__ and not __length_hint__, as the later is considerably slower.
* Micro-optimize list index range checks (GH-9784)Raymond Hettinger2018-10-111-5/+18
|
* bpo-34151: Improve performance of some list operations (GH-8332)Sergey Fedoseev2018-08-111-15/+36
|
* bpo-34301: Add _PyInterpreterState_Get() helper function (GH-8592)Victor Stinner2018-08-031-1/+1
| | | | sys_setcheckinterval() now uses a local variable to parse arguments, before writing into interp->check_interval.
* bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. ↵Siddhesh Poyarekar2018-04-291-8/+8
| | | | | | | | | (GH-6030) METH_NOARGS functions need only a single argument but they are cast into a PyCFunction, which takes two arguments. This triggers an invalid function cast warning in gcc8 due to the argument mismatch. Fix this by adding a dummy unused argument.
* closes bpo-32898: Fix debug build crash with COUNT_ALLOCS (GH-5800)Eddie Elizondo2018-02-221-1/+1
|
* bpo-28685: Fix compiler warning (GH-5423)Victor Stinner2018-01-291-1/+2
|
* bpo-28685: Optimize sorted() list.sort() with type-specialized comparisons ↵embg2018-01-291-71/+337
| | | | (#582)
* bpo-32137: The repr of deeply nested dict now raises a RecursionError (#4570)Serhiy Storchaka2017-12-031-3/+0
| | | | | instead of crashing due to a stack overflow. This perhaps will fix similar problems in other extension types.
* bpo-32030: Add more options to _PyCoreConfig (#4485)Victor Stinner2017-11-211-8/+3
| | | | | | Py_Main() now handles two more -X options: * -X showrefcount: new _PyCoreConfig.show_ref_count field * -X showalloccount: new _PyCoreConfig.show_alloc_count field
* bpo-23699: Use a macro to reduce boilerplate code in rich comparison ↵stratakis2017-11-021-24/+3
| | | | functions (GH-793)
* bpo-30860: Consolidate stateful runtime globals. (#3397)Eric Snow2017-09-081-0/+1
| | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* Expand the PySlice_GetIndicesEx macro. (#1023)Serhiy Storchaka2017-04-081-4/+6
|
* bpo-29748: Added the slice index converter in Argument Clinic. (#549)Serhiy Storchaka2017-03-191-3/+3
|
* bpo-24037: Add Argument Clinic converter `bool(accept={int})`. (#485)Serhiy Storchaka2017-03-121-2/+2
|
* bpo-20185: Convert list object implementation to Argument Clinic. (#542)Serhiy Storchaka2017-03-111-150/+223
|
* bpo-29695: Remove bad keyword parameters in int(), bool(), float(), list() ↵Serhiy Storchaka2017-03-061-8/+3
| | | | and tuple(). (#518)
* bpo-29695: Deprecated using bad named keyword arguments in builtings: (#486)Serhiy Storchaka2017-03-051-0/+6
| | | | int(), bool(), float(), list() and tuple(). Specify the value as a positional argument instead.
* bpo-27660: remove unnecessary overflow checks in list_resize (GH-189)Xiang Zhang2017-02-221-12/+7
|
* Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE whereverSerhiy Storchaka2017-01-231-4/+2
| | | | possible. Patch is writen with Coccinelle.
* Issue #29331: Simplified argument parsing in sorted() and list.sort().Serhiy Storchaka2017-01-211-15/+15
|
* Issue #1621: Overflow should not be possible in listextend()Martin Panter2017-01-141-0/+3
|
* Backed out changeset b9c9691c72c5Victor Stinner2016-12-041-1/+2
| | | | | | Issue #28858: The change b9c9691c72c5 introduced a regression. It seems like _PyObject_CallArg1() uses more stack memory than PyObject_CallFunctionObjArgs().
* Replace PyObject_CallFunctionObjArgs() with fastcallVictor Stinner2016-12-011-2/+1
| | | | | | | | | | | | | | * PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func) * PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg) PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires extra work to "parse" C arguments to build a C array of PyObject*. _PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate memory on the C stack. This change is part of the fastcall project. The change on listsort() is related to the issue #23507.
* replace PY_SIZE_MAX with SIZE_MAXBenjamin Peterson2016-09-071-2/+2
|
* merge 3.5Benjamin Peterson2016-09-071-6/+9
|\
| * make sure to not call memcpy with a NULL second argumentBenjamin Peterson2016-09-071-6/+9
| |
* | Issue #27662: don't use PY_SIZE_MAX for overflow checking in List_New. Patch ↵Mark Dickinson2016-08-211-11/+1
| | | | | | | | by Xiang Zhang.
* | Issue #1621: Avoid signed overflow in list and tuple operationsMartin Panter2016-07-251-8/+10
| | | | | | | | Patch by Xiang Zhang.
* | Issue #23034: The output of a special Python build with defined COUNT_ALLOCS,Serhiy Storchaka2016-07-031-0/+10
| | | | | | | | | | | | SHOW_ALLOC_COUNT or SHOW_TRACK_COUNT macros is now off by default. It can be re-enabled using the "-X showalloccount" option. It now outputs to stderr instead of stdout.
* | Issue #26200: Added Py_SETREF and replaced Py_XSETREF with Py_SETREFSerhiy Storchaka2016-04-101-1/+1
|\ \ | |/ | | | | in places where Py_DECREF was used.