9 Commits

Author SHA1 Message Date
Shahar Naveh
6a860b635a Update some tests to 3.14.5 (#7991) 2026-06-02 18:00:54 +09:00
Changjoon
330b18f2fe Preserve recursively-set value in defaultdict.__missing__ (#7718)
CPython's defaultdict.__missing__ (Modules/_collectionsmodule.c::defdict_missing)
calls default_factory() first; if the factory's recursion already populated
self[key] while running, the existing value is preserved instead of being
overwritten.

RustPython ships a Python fallback at Lib/collections/_defaultdict.py
(the C _collections.defaultdict is not available). That fallback
unconditionally executed self[key] = val after the factory returned,
overwriting any value the recursive call had already stored.

Add a 'if key in self: return self[key]' guard before the assignment.
dict.__contains__ does not invoke __missing__, so there's no recursion
risk; in the common non-reentrant case the check is False and behavior
is unchanged.

Unmasks test_defaultdict.TestDefaultDict.test_factory_conflict_with_set_value.
2026-04-29 18:14:32 +09:00
ShaharNaveh
5124f8aca7 Mark failing test 2026-02-13 18:06:47 +09:00
ShaharNaveh
9d7387798c Update test_defaultdict.py from 3.14.3 2026-02-13 18:06:47 +09:00
NakanoMiku
926c4cef27 Update test_defaultdict.py from CPython v3.12.0 2023-11-30 20:27:46 +08:00
Gyubong Lee
3c9e92cebb Add or, ror andior to defaultdict 2022-07-22 12:16:13 +09:00
Jeong Yunwon
7580e11320 adjust failing markers for test_{collections,defaultdict} 2022-07-18 03:54:49 +09:00
CPython developers
9537149572 Update collections/test_{collections,defaultdict} from CPython 3.10.5 2022-07-18 03:54:49 +09:00
Noah
c84eb2a801 Copy test_defaultdict from CPython 3.8 2021-04-11 17:38:45 -05:00