Repository navigation
Commit 28393e9
Implement PEP 814 frozendict (#8951)
* Restore consolidated frozendict implementation on current main
Preserve reverse dictionary iterator fixes and the 3.15 frame imports. Keep library refreshes separate pending the runtime dependency sequencing decision.
Assisted-by: OpenAI Codex:model identifier unavailable
* Support scoped canonical test updates in update_lib
Index conditional test classes and methods without crossing namespaces, reject ambiguous targets, and preserve inherited override indentation. Add hash-pinned whole-test copying that verifies execution context and exact source bytes, with focused Python fixtures.
Assisted-by: OpenAI Codex:model identifier unavailable
* Align frozendict copy support and tests with CPython 3.15
Import exact-final copy.py with update_lib; defer Mapping ABC registration to the later library stage. Generate only proven marker corrections, retain observed debug recursion-limit expected failures, and copy the complete canonical builtin-doc discovery test using hash-pinned update_lib copy-test.
Assisted-by: OpenAI Codex:model identifier unavailable
* Preserve decorator rationale during canonical test copying
Reject differing decorator source blocks even when their ASTs match. Cover inline and multiline marker comments, guarded async methods, and CLI no-write behavior.
Assisted-by: OpenAI Codex:model identifier unavailable
* Finish frozendict with borrowed PyAnyDict views
Use the landed PyRef target model for a transparent dict/frozendict header
view, retaining objects explicitly with PyRef<PyAnyDict>. Keep targets
sealed and preserve mutable-only entry points. Borrow frame globals from
the object header rather than movable reference wrappers.
Unify exact-TypeError key diagnostics with final CPython semantics,
including callback failure propagation and no explicit cause. Keep the
Python regressions in builtin_dict and test reference layout/ownership
in Rust. Preserve existing canonical library updates.
Assisted-by: OpenAI Codex:model identifier unavailable
* Align frozendict with CPython and use CPython 3.15 tests
- Name the target type in unhashable key errors through
PyDict::update_arg (dict_update_arg), replacing the separate
PyFrozenDict::merge_into copy of the merge logic.
- Split the | operator into dict_or (_PyDict_Or) and frozendict_or.
- Return the argument from frozendict(frozendict) only when the called
type is frozendict.
- Call through the vectorcall slot in PyCallable::invoke when there
are no keyword arguments, instead of special-casing frozendict.
- Add ensure_builtins (_PyEval_EnsureBuiltins) for eval/exec, and
insert __builtins__ for source strings regardless of globals type.
- Read __warningregistry__ and __name__ from stored globals entries and
accept only None or str for the module name in setup_context.
- Remove the unused PyFrozenDict::from_object.
- Migrate test_dict.py, mapping_tests.py, test_copy.py and
test_builtin.py to v3.15.0 with update_lib, and add
test_import/data/syntax_warnings.py.
- Drop builtin_dict.py frozendict tests covered by those modules,
keeping the descriptor and namespace integration tests.
Assisted-by: Claude Code:claude-opus-5-5
* Update crates/vm/src/builtins/dict.rs
---------
Co-authored-by: Jeong YunWon <jeong@youknowone.org>
Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>1 parent bef501f commit 28393e9
40 files changed
Lines changed: 2705 additions & 493 deletions
File tree
- Lib
- test
- test_doctest
- test_import/data
- test_unittest/testmock
- crates
- capi/src
- vm/src
- builtins
- function
- object
- protocol
- stdlib
- types
- vm
- extra_tests/snippets
- scripts/update_lib
- tests
- src/shell
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
| 103 | + | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
108 | | - | |
| 107 | + | |
| 108 | + | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
126 | | - | |
| 125 | + | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
206 | 221 | | |
207 | 222 | | |
208 | 223 | | |
| |||
230 | 245 | | |
231 | 246 | | |
232 | 247 | | |
233 | | - | |
| 248 | + | |
234 | 249 | | |
235 | 250 | | |
236 | 251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 25 | + | |
29 | 26 | | |
30 | 27 | | |
31 | 28 | | |
| |||
88 | 85 | | |
89 | 86 | | |
90 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
91 | 154 | | |
92 | 155 | | |
93 | 156 | | |
| |||
130 | 193 | | |
131 | 194 | | |
132 | 195 | | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | 196 | | |
174 | 197 | | |
175 | 198 | | |
| |||
265 | 288 | | |
266 | 289 | | |
267 | 290 | | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | 291 | | |
285 | 292 | | |
286 | 293 | | |
| |||
622 | 629 | | |
623 | 630 | | |
624 | 631 | | |
625 | | - | |
| 632 | + | |
626 | 633 | | |
627 | 634 | | |
628 | 635 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4394 | 4394 | | |
4395 | 4395 | | |
4396 | 4396 | | |
4397 | | - | |
4398 | | - | |
4399 | 4397 | | |
4400 | 4398 | | |
4401 | 4399 | | |
| |||
4443 | 4441 | | |
4444 | 4442 | | |
4445 | 4443 | | |
4446 | | - | |
4447 | | - | |
4448 | 4444 | | |
4449 | 4445 | | |
4450 | 4446 | | |
| |||
0 commit comments