Repository navigation
Commit 8765a69
gh-163129: Size new generators from the frame's code object
Currently RETURN_GENERATOR sizes the new generator (and determines its
type) from the code object loaded from the function on the current
frame. This is not necessarily the same code object that was current
when the frame was actually pushed. The function's __code__ could have
been re-assigned in the interim. This is dangerous as the generator's
frame size won't match that of the interpreter, and when the interpreter
goes to call _PyFrame_Copy it risks a heap overflow.
Pass the frame's code object to _Py_MakeCoro() explicitly instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent 6ed9dc2 commit 8765a69
8 files changed
Lines changed: 58 additions & 12 deletions
File tree
- Include/internal
- Lib/test
- Misc/NEWS.d/next/Core_and_Builtins
- Modules/_testinternalcapi
- Objects
- Python
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
269 | | - | |
| 269 | + | |
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
333 | 372 | | |
334 | 373 | | |
335 | 374 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1104 | 1104 | | |
1105 | 1105 | | |
1106 | 1106 | | |
1107 | | - | |
| 1107 | + | |
1108 | 1108 | | |
1109 | | - | |
1110 | 1109 | | |
1111 | 1110 | | |
1112 | 1111 | | |
| |||
1127 | 1126 | | |
1128 | 1127 | | |
1129 | 1128 | | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
1130 | 1134 | | |
1131 | | - | |
| 1135 | + | |
1132 | 1136 | | |
1133 | | - | |
| 1137 | + | |
1134 | 1138 | | |
1135 | 1139 | | |
1136 | 1140 | | |
1137 | | - | |
| 1141 | + | |
1138 | 1142 | | |
1139 | 1143 | | |
1140 | 1144 | | |
1141 | | - | |
| 1145 | + | |
1142 | 1146 | | |
1143 | 1147 | | |
1144 | 1148 | | |
| |||
1150 | 1154 | | |
1151 | 1155 | | |
1152 | 1156 | | |
1153 | | - | |
| 1157 | + | |
1154 | 1158 | | |
1155 | 1159 | | |
1156 | 1160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5810 | 5810 | | |
5811 | 5811 | | |
5812 | 5812 | | |
5813 | | - | |
| 5813 | + | |
5814 | 5814 | | |
5815 | 5815 | | |
5816 | 5816 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments