Miss Islington (bot)
021e5db20b
bpo-36946:Fix possible signed integer overflow when handling slices. (GH-15639)
...
This is a complement to PR 13375.
(cherry picked from commit 3c87a667bb
)
Co-authored-by: HongWeipeng <hongweichen8888@sina.com>
2019-09-08 03:36:38 -07:00
Miss Islington (bot)
367fe5757a
bpo-35091: Objects/listobject.c: Replace overflow checks in gallop fu… (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 6bc5917903
)
Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
2019-05-22 17:18:55 -07:00
Miss Islington (bot)
9dbb09fc27
bpo-36218: Fix handling of heterogeneous values in list.sort (GH-12209) GH-12532)
...
(cherry picked from commit dd5417afcf
)
Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
2019-03-25 00:47:55 -07:00
Miss Islington (bot)
0e73ea26a5
bpo-33989: Ensure that ms.key_compare is always initialized in list_sort_impl(). (GH-8710)
...
(cherry picked from commit ebc793d6ac
)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-02-21 00:05:22 -08:00
Miss Islington (bot)
a5955b0895
closes bpo-35623: Fix integer overflow when sorting large lists (GH-11380)
...
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 f8b534477a
)
Co-authored-by: sth <sth.dev@tejp.de>
2019-01-01 18:25:23 -08:00
Miss Islington (bot)
bc2e110469
closes bpo-32898: Fix debug build crash with COUNT_ALLOCS (GH-5800)
...
(cherry picked from commit 745dc65b17
)
Co-authored-by: Eddie Elizondo <eduardo.elizondorueda@gmail.com>
2018-02-21 21:44:08 -08:00
Victor Stinner
8017b804a0
bpo-28685: Fix compiler warning (GH-5423)
2018-01-29 13:47:06 +01:00
embg
1e34da49ef
bpo-28685: Optimize sorted() list.sort() with type-specialized comparisons ( #582 )
2018-01-28 19:03:23 -08:00
Serhiy Storchaka
1fb72d2ad2
bpo-32137: The repr of deeply nested dict now raises a RecursionError ( #4570 )
...
instead of crashing due to a stack overflow.
This perhaps will fix similar problems in other extension types.
2017-12-03 22:12:11 +02:00
Victor Stinner
25420fe290
bpo-32030: Add more options to _PyCoreConfig ( #4485 )
...
Py_Main() now handles two more -X options:
* -X showrefcount: new _PyCoreConfig.show_ref_count field
* -X showalloccount: new _PyCoreConfig.show_alloc_count field
2017-11-20 18:12:22 -08:00
stratakis
e8b1965639
bpo-23699: Use a macro to reduce boilerplate code in rich comparison functions (GH-793)
2017-11-02 20:32:54 +10:00
Eric Snow
2ebc5ce42a
bpo-30860: Consolidate stateful runtime globals. ( #3397 )
...
* 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).
2017-09-07 23:51:28 -06:00
Serhiy Storchaka
b879fe82e7
Expand the PySlice_GetIndicesEx macro. ( #1023 )
2017-04-08 09:53:51 +03:00
Serhiy Storchaka
80ec8364f1
bpo-29748: Added the slice index converter in Argument Clinic. ( #549 )
2017-03-19 19:37:40 +02:00
Serhiy Storchaka
202fda55c2
bpo-24037: Add Argument Clinic converter `bool(accept={int})`. ( #485 )
2017-03-12 10:10:47 +02:00
Serhiy Storchaka
fdd42c481e
bpo-20185: Convert list object implementation to Argument Clinic. ( #542 )
2017-03-11 09:19:20 +02:00
Serhiy Storchaka
2e5642422f
bpo-29695: Remove bad keyword parameters in int(), bool(), float(), list() and tuple(). ( #518 )
2017-03-06 17:01:06 +02:00
Serhiy Storchaka
58d23e6806
bpo-29695: Deprecated using bad named keyword arguments in builtings: ( #486 )
...
int(), bool(), float(), list() and tuple(). Specify the value as a
positional argument instead.
2017-03-06 00:53:39 +02:00
Xiang Zhang
4cee049f5b
bpo-27660: remove unnecessary overflow checks in list_resize (GH-189)
2017-02-22 12:32:30 +08:00
Serhiy Storchaka
228b12edcc
Issue #28999 : Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever
...
possible. Patch is writen with Coccinelle.
2017-01-23 09:47:21 +02:00
Serhiy Storchaka
7cf8bebb07
Issue #29331 : Simplified argument parsing in sorted() and list.sort().
2017-01-21 23:05:00 +02:00
Martin Panter
94b39ceb73
Issue #1621 : Overflow should not be possible in listextend()
2017-01-14 06:30:37 +00:00
Victor Stinner
de4ae3d486
Backed out changeset b9c9691c72c5
...
Issue #28858 : The change b9c9691c72c5 introduced a regression. It seems like
_PyObject_CallArg1() uses more stack memory than
PyObject_CallFunctionObjArgs().
2016-12-04 22:59:09 +01:00
Victor Stinner
27580c1fb5
Replace PyObject_CallFunctionObjArgs() with fastcall
...
* 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 .
2016-12-01 14:43:22 +01:00
Benjamin Peterson
2f8bfef158
replace PY_SIZE_MAX with SIZE_MAX
2016-09-07 09:26:18 -07:00
Benjamin Peterson
05448a62ae
merge 3.5
2016-09-06 17:58:44 -07:00
Benjamin Peterson
5a7d923e75
make sure to not call memcpy with a NULL second argument
2016-09-06 17:58:25 -07:00
Mark Dickinson
5d13238f6e
Issue #27662 : don't use PY_SIZE_MAX for overflow checking in List_New. Patch by Xiang Zhang.
2016-08-21 08:55:15 +01:00
Martin Panter
b93d8637a6
Issue #1621 : Avoid signed overflow in list and tuple operations
...
Patch by Xiang Zhang.
2016-07-25 02:39:20 +00:00
Serhiy Storchaka
7e160ce356
Issue #23034 : The output of a special Python build with defined COUNT_ALLOCS,
...
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.
2016-07-03 21:03:53 +03:00
Serhiy Storchaka
f01e408c16
Issue #26200 : Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
...
in places where Py_DECREF was used.
2016-04-10 18:12:01 +03:00
Serhiy Storchaka
ec39756960
Issue #22570 : Renamed Py_SETREF to Py_XSETREF.
2016-04-06 09:50:03 +03:00
Serhiy Storchaka
ab479c49d3
Issue #26494 : Fixed crash on iterating exhausting iterators.
...
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:41:15 +03:00
Serhiy Storchaka
fbb1c5ee06
Issue #26494 : Fixed crash on iterating exhausting iterators.
...
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:40:02 +03:00
Raymond Hettinger
0dceb91866
Tests versus zero are more compact than tests versus -1.
2016-01-25 10:33:30 -08:00
Serhiy Storchaka
1ed017ae92
Issue #20440 : Cleaning up the code by using Py_SETREF and Py_CLEAR.
...
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.
2015-12-27 15:51:32 +02:00
Serhiy Storchaka
5c4064e8bd
Issue #25421 : __sizeof__ methods of builtin types now use dynamic basic size.
...
This allows sys.getsize() to work correctly with their subclasses with
__slots__ defined.
2015-12-19 20:05:25 +02:00
Benjamin Peterson
a30e2256f7
merge 3.4 ( #24044 )
2015-04-23 17:06:45 -04:00
Benjamin Peterson
bd91ee9cd7
merge 3.3 ( #24044 )
2015-04-23 17:06:33 -04:00
Benjamin Peterson
51454a62e2
merge 3.2 ( #24044 )
2015-04-23 17:05:07 -04:00
Benjamin Peterson
0823ffb2fb
properly handle malloc failure ( closes #24044 )
...
Patch by Christian Heimes.
2015-04-23 17:04:36 -04:00
Benjamin Peterson
c8fd9ce73d
merge 3.4 ( #23515 )
2015-02-25 10:16:56 -05:00
Benjamin Peterson
b808d590a2
fix merge_collapse to actually maintain the invariant it purports to ( closes #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"
2015-02-25 10:12:26 -05:00
Terry Jan Reedy
ffff1440d1
Issue #22077 : Improve index error messages for bytearrays, bytes, lists, and
...
tuples by adding 'or slices'. Added ', not <typename' for bytearrays.
Original patch by Claudiu Popa.
2014-08-02 01:30:37 -04:00
Benjamin Peterson
af9049ebbc
merge 3.3
2014-03-15 12:21:47 -05:00
Benjamin Peterson
4a42cd48d5
avoid referencing past the bounds of an array
2014-03-15 12:21:28 -05:00
Benjamin Peterson
1aca78da62
merge 3.3
2014-03-14 21:54:41 -05:00
Benjamin Peterson
ef87f8cb57
avoid referencing out-of-bounds memory
2014-03-14 21:54:31 -05:00
Kristján Valur Jónsson
25dded041f
Make the various iterators' "setstate" sliently and consistently clip the
...
index. This avoids the possibility of setting an iterator to an invalid
state.
2014-03-05 13:47:57 +00:00
Kristján Valur Jónsson
c5cc5011ac
Make the various iterators' "setstate" sliently and consistently clip the
...
index. This avoids the possibility of setting an iterator to an invalid
state.
2014-03-05 15:23:07 +00:00