20 Commits
Author SHA1 Message Date
youknowdot feca6f2004 Align collections and testing libraries with Python 3.15 (#9192)
* Align collections and testing libraries with Python 3.15

Refresh twelve production modules and canonical tests through scripts/update_lib at CPython d220409a13b77de7a6c30abe16ea90db01528edc. Preserve existing RustPython unittest helpers and test guards. Accept frozendict in native defaultdict and OrderedDict union slots, matching upstream PyAnyDict_Check without changing constructors, factories, or update order.

Validated as a local stack on the exact #9189 regex/dataclasses/typing prerequisite; this dependency avoids eager typing.ByteString deprecation during unittest warning tests.

Assisted-by: OpenAI Codex: model version unavailable

* Synchronize regression runner with doctest subtest reporting

Refresh the canonical test_regrtest consumer and its direct runner/pythoninfo closure through scripts/update_lib at CPython d220409a13b77de7a6c30abe16ea90db01528edc. Preserve both existing expected-failure markers. This aligns the runner test with doctest reporting two failed examples and one skipped example.

Assisted-by: OpenAI Codex: model version unavailable
2026-10-19 20:07:29 +09:00
Shahar Naveh e71a955c99 Update some libs and tests to 3.14.7 (#8559)
* Update some libs

* Update some tests

* more tests

* test_pydoc.py

* test_mimetypes.py

* Restore json decoder

* reapply updaye
2026-08-23 00:13:15 +09:00
Shahar Naveh 7350a5b709 Implement collections.defaultdict in rust (#8132) 2026-06-23 22:47:10 +09:00
Changjoon 79105e5273 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
github-actions[bot]andCPython Developers 3280d61162 Update collections from v3.14.3 (#7135)
- Updated Lib/collections from CPython v3.14.3
- Preserved RustPython's fallback implementation for defaultdict
- Added test for update_reentrant_add_clears_counter
- Minor formatting fixes in test file

Co-authored-by: CPython Developers <>
2026-02-14 21:35:25 +09:00
Lee Dogeon 3bcd071e4d Bump collections to 3.14.2 (#6770)
* Bump collections to 3.14.2

* Unmark resolved tests
2026-01-20 23:58:43 +09:00
Daniel Chiquito bcb35919a4 Update collections/__init__.py to 3.12.2 2024-02-23 20:14:41 -05:00
Joshua Mankelow 32aa9933be Updated __init__.py to be inline with CPython 3.11.2 2023-04-20 15:20:36 +09:00
Gyubong Lee 9c2a5041e9 Reflect feedbacks 2022-07-22 13:16:12 +09:00
Gyubong Lee 3c9e92cebb Add or, ror andior to defaultdict 2022-07-22 12:16:13 +09:00
CPython developers 9537149572 Update collections/test_{collections,defaultdict} from CPython 3.10.5 2022-07-18 03:54:49 +09:00
Chris Moradi 6abfc3a00c Revert UserDict.__init__ changes, new passing test of UserList 2021-10-25 22:41:59 -07:00
Chris Moradi ec247e0d4f Update collections from CPython, fix tests for UserDict/List/String
Clean implementation of changes in PR #3371 based on feedback.

Copies from [CPython tag `v3.9.7` and adds back custom RustPython changes where needed for:
- `Lib/collections/__init__.py`
- `Lib/test/test_collections.py`

Closes: #3371
2021-10-25 21:19:44 -07:00
Noah 3c3801bbe4 Improve defaultdict some more 2021-04-11 17:38:44 -05:00
Noah 1b3408f00d Fix defaultdict 2021-04-11 17:38:44 -05:00
Noah f8d39cc648 Fix defaultdict 2020-10-07 19:29:41 -05:00
coolreader18 14e3ebe48f Add selectors module from CPython 3.6 2019-10-23 17:53:51 +00:00
coolreader18 9ec6660c09 Add argparse and gettext modules 2019-07-19 22:38:09 -05:00
coolreader18 5e5d726a5d Add defaultdict to collections 2019-07-10 22:16:37 -05:00
coolreader18 c78c95f03a Add CPython library modules needed for unittest 2019-06-26 11:39:10 -05:00