Commit 2690c16
authored
marshal: refuse a back-reference to an object still being written (#8519)
`w_ref` marks a code or slice entry incomplete until `w_complete`, because
the reader rebuilds both from their fields and a `TYPE_REF` issued while
those fields are still on the wire names an object that does not exist
yet. `WriterRefTable` carries that marker and `write_object_depth`
raises `cannot marshal recursion <type> objects` instead of emitting the
reference.
`test_reference_loop_code`, `test_unmarshallable` and
`test_reference_loop_slice` lose their RustPython markers; `test_marshal`
is 75 run, 16 skipped.
Assisted-by: Claude1 parent fd7d107 commit 2690c16
2 files changed
Lines changed: 51 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
356 | | - | |
357 | 356 | | |
358 | 357 | | |
359 | 358 | | |
| |||
367 | 366 | | |
368 | 367 | | |
369 | 368 | | |
370 | | - | |
371 | 369 | | |
372 | 370 | | |
373 | 371 | | |
| |||
541 | 539 | | |
542 | 540 | | |
543 | 541 | | |
544 | | - | |
545 | 542 | | |
546 | 543 | | |
547 | 544 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
134 | 141 | | |
135 | | - | |
| 142 | + | |
136 | 143 | | |
137 | 144 | | |
138 | 145 | | |
| |||
143 | 150 | | |
144 | 151 | | |
145 | 152 | | |
146 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
147 | 157 | | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
155 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
156 | 167 | | |
157 | | - | |
| 168 | + | |
158 | 169 | | |
159 | | - | |
| 170 | + | |
| 171 | + | |
160 | 172 | | |
161 | 173 | | |
162 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
163 | 182 | | |
164 | 183 | | |
165 | 184 | | |
| |||
199 | 218 | | |
200 | 219 | | |
201 | 220 | | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
207 | 232 | | |
208 | 233 | | |
209 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
210 | 241 | | |
211 | | - | |
| 242 | + | |
212 | 243 | | |
213 | 244 | | |
214 | 245 | | |
| |||
366 | 397 | | |
367 | 398 | | |
368 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
369 | 403 | | |
370 | 404 | | |
371 | 405 | | |
| |||
0 commit comments