summaryrefslogtreecommitdiff
path: root/Objects/listobject.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-35091: Objects/listobject.c: Replace overflow checks in gallop fu… ↵Miss Islington (bot)2019-05-221-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 (cherry picked from commit 6bc5917903b722bdd0e5d3020949f26fec5dfe9a) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* bpo-36218: Fix handling of heterogeneous values in list.sort (GH-12209) ↵Miss Islington (bot)2019-03-251-11/+22
| | | | | | | GH-12532) (cherry picked from commit dd5417afcf8924bcdd7077351941ad21727ef644) Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
* bpo-33989: Ensure that ms.key_compare is always initialized in ↵Miss Islington (bot)2019-02-211-0/+3
| | | | | | | list_sort_impl(). (GH-8710) (cherry picked from commit ebc793d6acb9650b9f497808e059805892031d74) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* closes bpo-35623: Fix integer overflow when sorting large lists (GH-11380)Miss Islington (bot)2019-01-011-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. (cherry picked from commit f8b534477a2a51d85ea1663530f685f805f2b247) Co-authored-by: sth <sth.dev@tejp.de>
* closes bpo-32898: Fix debug build crash with COUNT_ALLOCS (GH-5800)Miss Islington (bot)2018-02-211-1/+1
| | | | | (cherry picked from commit 745dc65b17b3936e3f9f4099f735f174d30c4e0c) Co-authored-by: Eddie Elizondo <eduardo.elizondorueda@gmail.com>
* 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-281-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-201-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-071-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-061-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-061-6/+9
|\
| * make sure to not call memcpy with a NULL second argumentBenjamin Peterson2016-09-061-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.
* | Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-2/+2
|\ \ | |/
* | Issue #26494: Fixed crash on iterating exhausting iterators.Serhiy Storchaka2016-03-301-7/+13
|\ \ | |/ | | | | | | | | Affected classes are generic sequence iterators, iterators of str, bytes, bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding views and os.scandir() iterator.
| * Issue #26494: Fixed crash on iterating exhausting iterators.Serhiy Storchaka2016-03-301-7/+13
| | | | | | | | | | | | Affected classes are generic sequence iterators, iterators of str, bytes, bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding views and os.scandir() iterator.
* | Tests versus zero are more compact than tests versus -1.Raymond Hettinger2016-01-251-6/+6
| |
* | Issue #20440: Cleaning up the code by using Py_SETREF and Py_CLEAR.Serhiy Storchaka2015-12-271-8/+2
|/ | | | | Old code is correct, but with Py_SETREF and Py_CLEAR it can be cleaner. This patch doesn't fix bugs and hence there is no need to backport it.
* Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size.Serhiy Storchaka2015-12-191-1/+1
| | | | | This allows sys.getsize() to work correctly with their subclasses with __slots__ defined.
* merge 3.4 (#24044)Benjamin Peterson2015-04-231-2/+4
|\
| * merge 3.3 (#24044)Benjamin Peterson2015-04-231-2/+4
| |\
| | * merge 3.2 (#24044)Benjamin Peterson2015-04-231-2/+4
| | |\
| | | * properly handle malloc failure (closes #24044)Benjamin Peterson2015-04-231-2/+4
| | | | | | | | | | | | | | | | Patch by Christian Heimes.
* | | | merge 3.4 (#23515)Benjamin Peterson2015-02-251-1/+2
|\ \ \ \ | |/ / /
| * | | fix merge_collapse to actually maintain the invariant it purports to (closes ↵Benjamin Peterson2015-02-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #23515) See de Gouw, Stijn and Rot, Jurriaan and de Boer, Frank S and Bubel, Richard and Hähnle, Reiner "OpenJDK’s java.utils.Collection.sort() is broken: The good, the bad and the worst case"
* | | | Issue #22077: Improve index error messages for bytearrays, bytes, lists, andTerry Jan Reedy2014-08-021-2/+2
|/ / / | | | | | | | | | | | | tuples by adding 'or slices'. Added ', not <typename' for bytearrays. Original patch by Claudiu Popa.
* | | merge 3.3Benjamin Peterson2014-03-151-1/+1
|\ \ \ | |/ /
| * | avoid referencing past the bounds of an arrayBenjamin Peterson2014-03-151-1/+1
| | |
* | | merge 3.3Benjamin Peterson2014-03-141-1/+1
|\ \ \ | |/ /
| * | avoid referencing out-of-bounds memoryBenjamin Peterson2014-03-141-1/+1
| | |
* | | Make the various iterators' "setstate" sliently and consistently clip theKristján Valur Jónsson2014-03-051-0/+2
|\ \ \ | |/ / | | | | | | | | | index. This avoids the possibility of setting an iterator to an invalid state.
| * | Make the various iterators' "setstate" sliently and consistently clip theKristján Valur Jónsson2014-03-051-0/+2
| | | | | | | | | | | | | | | index. This avoids the possibility of setting an iterator to an invalid state.
* | | Close #19578: Fix list_ass_subscript(), handle list_resize() failureVictor Stinner2013-11-211-2/+3
| | | | | | | | | | | | Notify the caller of the failure (MemoryError exception).