Donghee Na
297f2e093e
gh-123083: Fix a potential use-after-free in ``STORE_ATTR_WITH_HINT`` (gh-123092)
2024-08-22 23:49:09 +09:00
Erlend E. Aasland
ca62ffd1a5
gh-116303: Skip tests if C recursion limit is unavailable (GH-117368)
...
The test suite fetches the C recursion limit from the _testcapi
extension module. Test extension modules can be disabled using the
--disable-test-modules configure option.
2024-04-08 14:45:25 +02:00
Victor Stinner
b0edf3b98e
GH-91079: Rename C_RECURSION_LIMIT to Py_C_RECURSION_LIMIT ( #108507 )
...
Symbols of the C API should be prefixed by "Py_" to avoid conflict
with existing names in 3rd party C extensions on "#include <Python.h>".
test.pythoninfo now logs Py_C_RECURSION_LIMIT constant and other
_testcapi and _testinternalcapi constants.
2023-09-08 09:48:28 +00:00
Victor Stinner
26893016a7
gh-106320: Remove private _PyDict functions ( #108449 )
...
Move private functions to the internal C API (pycore_dict.h):
* _PyDictView_Intersect()
* _PyDictView_New()
* _PyDict_ContainsId()
* _PyDict_DelItemId()
* _PyDict_DelItem_KnownHash()
* _PyDict_GetItemIdWithError()
* _PyDict_GetItem_KnownHash()
* _PyDict_HasSplitTable()
* _PyDict_NewPresized()
* _PyDict_Next()
* _PyDict_Pop()
* _PyDict_SetItemId()
* _PyDict_SetItem_KnownHash()
* _PyDict_SizeOf()
No longer export most of these functions.
Move also the _PyDictViewObject structure to the internal C API.
Move dict_getitem_knownhash() function from _testcapi to the
_testinternalcapi extension. Update test_capi.test_dict for this
change.
2023-08-24 20:01:50 +00:00
Mark Shannon
fa45958450
GH-107263: Increase C stack limit for most functions, except `_PyEval_EvalFrameDefault()` (GH-107535)
...
* Set C recursion limit to 1500, set cost of eval loop to 2 frames, and compiler mutliply to 2.
2023-08-04 10:10:29 +01:00
tqxia
636e9dd23f
gh-94808: Improve coverage of dictresize (GH-100619)
2022-12-31 18:15:30 +09:00
Nikita Sobolev
6c83c8e6b5
bpo-46198: rename duplicate tests and remove unused code (GH-30297)
2022-03-10 08:20:11 -08:00
Inada Naoki
4f74052b45
bpo-40116: dict: Add regression test for iteration order. (GH-31550)
2022-03-03 13:06:29 +09:00
Dennis Sweeney
036fead695
bpo-45609: Specialize STORE_SUBSCR (GH-29242)
...
* Specialize STORE_SUBSCR for list[int], and dict[object]
* Adds _PyDict_SetItem_Take2 which consumes references to the key and values.
2021-11-19 10:30:37 +00:00
Christian Heimes
e73283a20f
bpo-45668: Fix PGO tests without test extensions (GH-29315)
2021-11-01 11:14:53 +01:00
Mark Shannon
a8b9350964
bpo-45340: Don't create object dictionaries unless actually needed (GH-28802)
...
* Never change types' cached keys. It could invalidate inline attribute objects.
* Lazily create object dictionaries.
* Update specialization of LOAD/STORE_ATTR.
* Don't update shared keys version for deletion of value.
* Update gdb support to handle instance values.
* Rename SPLIT_KEYS opcodes to INSTANCE_VALUE.
2021-10-13 14:19:34 +01:00
Christian Clauss
745c9d9dfc
Fix typos in the Lib directory (GH-28775)
...
Fix typos in the Lib directory as identified by codespell.
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2021-10-06 16:13:48 -07:00
Mark Shannon
a7252f88d3
bpo-40116: Add insertion order bit-vector to dict values to allow dicts to share keys more freely. (GH-28520)
2021-10-06 13:19:53 +01:00
Hristo Venev
8557edbfa8
bpo-24275: Don't downgrade unicode-only dicts to mixed on lookups (GH-25186)
2021-04-29 11:06:03 +09:00
Brandt Bucher
226a012d1c
bpo-42536: GC track recycled tuples (GH-23623)
...
Several built-in and standard library types now ensure that their internal result tuples are always tracked by the garbage collector:
- collections.OrderedDict.items
- dict.items
- enumerate
- functools.reduce
- itertools.combinations
- itertools.combinations_with_replacement
- itertools.permutations
- itertools.product
- itertools.zip_longest
- zip
Previously, they could have become untracked by a prior garbage collection.
2020-12-04 19:45:57 -08:00
Dennis Sweeney
3ee0e48b03
bpo-40890: Add `mapping` property to dict views (GH-20749)
2020-06-12 10:19:25 -07:00
Dennis Sweeney
07d8112812
bpo-40889: Optimize dict.items() ^ dict.items() (GH-20718)
2020-06-10 14:56:56 +09:00
Dong-hee Na
785f5e6d67
bpo-40489: Add test case for dict contain use after free (GH-19906)
2020-05-05 02:30:42 +09:00
Brandt Bucher
eb8ac57af2
bpo-36144: Dictionary Union (PEP 584) ( #12088 )
2020-02-24 19:47:34 -08:00
Dong-hee Na
2d5bf568ea
bpo-38588: Fix possible crashes in dict and list when calling PyObject_RichCompareBool (GH-17734)
...
Take strong references before calling PyObject_RichCompareBool to protect against the case
where the object dies during the call.
2019-12-31 01:04:22 +00:00
Dong-hee Na
24dc2f8c56
bpo-38525: Fix a segmentation fault when using reverse iterators of empty dict (GH-16846)
...
The reverse iterator for empty dictionaries was not handling correctly shared-key dictionaries.
2019-10-19 21:01:08 +01:00
Thomas Perl
b8311cf5e5
bpo-36473: add maximum iteration check for dict .values() and .items() (GH-12619)
2019-04-02 18:30:10 +09:00
Thomas Perl
796cc6e3ad
bpo-36452: dictiter: track maximum iteration count (GH-12596)
2019-03-28 15:03:25 +09:00
Zackery Spytz
d1cbc6f8a0
Include the highest pickle protocol in a couple of tests. (GH-10735)
...
test_reduce_ex() in test_array.py and
test_reversevaluesiterator_pickling() in test_dict.py weren't using
the highest pickle protocol.
2018-11-27 07:40:49 +02:00
Rémi Lapeyre
6531bf6309
bpo-33462: Add __reversed__ to dict and dict views (GH-6827)
2018-11-06 09:38:54 +09:00
INADA Naoki
2aaf98c16a
bpo-34320: Fix dict(o) didn't copy order of dict subclass (GH-8624)
...
When dict subclass overrides order (`__iter__()`, `keys()`, and `items()`), `dict(o)`
should use it instead of dict ordering.
https://bugs.python.org/issue34320
2018-09-25 20:59:00 -07:00
Sergey Fedoseev
1f36bf6077
Test dict values iterator pickling with pickle.HIGHEST_PROTOCOL. (GH-9052)
2018-09-10 17:42:09 +08:00
Yury Selivanov
b0a7a037b8
bpo-31179: Make dict.copy() up to 5.5 times faster. ( #3067 )
2018-01-22 11:54:41 -05: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
Serhiy Storchaka
753bca3934
bpo-27945: Fixed various segfaults with dict. ( #1657 )
...
Based on patches by Duane Griffin and Tim Mitchell.
2017-05-20 12:30:02 +03:00
Victor Stinner
3d3f264849
Fix a memory leak in split-table dictionaries
...
Issue #28147 : Fix a memory leak in split-table dictionaries: setattr() must not
convert combined table into split table.
Patch written by INADA Naoki.
2016-12-15 17:21:23 +01:00
Serhiy Storchaka
f0b311bd73
Issue #28123 : _PyDict_GetItem_KnownHash() now can raise an exception as
...
PyDict_GetItemWithError(). Patch by Xiang Zhang.
2016-11-06 13:18:24 +02:00
INADA Naoki
93f26f794d
Issue #28583 : PyDict_SetDefault didn't combine split table when needed.
...
Patch by Xiang Zhang.
2016-11-02 18:45:16 +09:00
Victor Stinner
d0ad11f6b4
Fix _PyDict_Pop() on pending key
...
Issue #28120 : Fix dict.pop() for splitted dictionary when trying to remove a
"pending key" (Not yet inserted in split-table).
Patch by Xiang Zhang.
2016-09-13 16:56:38 +02:00
Victor Stinner
78601a38c2
Fix SystemError in compact dict
...
Issue #28040 : Fix _PyDict_DelItem_KnownHash() and _PyDict_Pop(): convert
splitted table to combined table to be able to delete the item.
Write an unit test for the issue.
Patch by INADA Naoki.
2016-09-09 19:28:36 -07:00
Martin Panter
e514093a2f
Issue #27125 : Merge typo fixes from 3.5
2016-05-30 05:24:49 +00:00
Martin Panter
a90a4a9651
Issue #27125 : Remove duplicated words from documentation and comments
2016-05-30 04:04:50 +00: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
Victor Stinner
5ebe2c89fe
Cleanup test_dict
...
* Write one import per line
* Sort imports by name
* Add an empty line: 2 empty lines between code blocks at the module level (PEP 8)
2016-01-23 13:52:05 +01:00
Serhiy Storchaka
a84f6c3dd3
Issue #25523 : Merge a-to-an corrections from 3.4.
2015-11-02 14:39:05 +02:00
Serhiy Storchaka
d65c9496da
Issue #25523 : Further a-to-an corrections.
2015-11-02 14:10:23 +02:00
Benjamin Peterson
e54d5321cc
merge 3.4 ( #24407 )
2015-07-04 19:59:24 -05:00
Benjamin Peterson
2a48a6eb33
merge 3.3 ( #24407 )
2015-07-04 19:58:11 -05:00
Benjamin Peterson
a82f77fb00
protect against mutation of the dict during insertion ( closes #24407 )
2015-07-04 19:55:16 -05:00
Zachary Ware
38c707e7e0
Issue #21741 : Update 147 test modules to use test discovery.
...
I have compared output between pre- and post-patch runs of these tests
to make sure there's nothing missing and nothing broken, on both
Windows and Linux. The only differences I found were actually tests
that were previously *not* run.
2015-04-13 15:00:43 -05:00
Serhiy Storchaka
bad1257c96
Issue #22777 : Test pickling with all protocols.
2014-12-15 14:03:42 +02:00
Antoine Pitrou
d696732025
Issue #22653 : Fix an assertion failure in debug mode when doing a reentrant dict insertion in debug mode.
2014-10-18 00:35:00 +02:00
Ezio Melotti
4e1f3d669b
#19166 : use an unused var in a test. Patch by Vajrasky Kok.
2013-10-05 03:07:03 +03:00
Benjamin Peterson
d97eb0d338
merge 3.2 ( #16345 )
2012-10-31 14:09:11 -04:00