Commit 9de3bc3
committed
gh-111331: Allow closing BytesIO with exported buffers
close() no longer fails with BufferError if there are exported buffers.
Every exported buffer keeps a reference to the internal buffer, so it
outlives closing of the BytesIO object. As a result, destroying or garbage
collecting such object no longer emits an unraisable exception.1 parent 998b890 commit 9de3bc3
4 files changed
Lines changed: 39 additions & 19 deletions
File tree
- Doc/library
- Lib/test/test_io
- Misc/NEWS.d/next/Library
- Modules/_io
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
763 | 763 | | |
764 | 764 | | |
765 | 765 | | |
766 | | - | |
| 766 | + | |
767 | 767 | | |
768 | 768 | | |
769 | 769 | | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
770 | 773 | | |
771 | 774 | | |
772 | 775 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | 460 | | |
464 | 461 | | |
465 | 462 | | |
| |||
474 | 471 | | |
475 | 472 | | |
476 | 473 | | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
| 474 | + | |
483 | 475 | | |
484 | 476 | | |
485 | 477 | | |
| |||
489 | 481 | | |
490 | 482 | | |
491 | 483 | | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
492 | 499 | | |
493 | 500 | | |
494 | 501 | | |
| |||
513 | 520 | | |
514 | 521 | | |
515 | 522 | | |
516 | | - | |
| 523 | + | |
517 | 524 | | |
518 | 525 | | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
| 526 | + | |
| 527 | + | |
524 | 528 | | |
| 529 | + | |
525 | 530 | | |
526 | 531 | | |
527 | 532 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
925 | 926 | | |
926 | 927 | | |
927 | 928 | | |
928 | | - | |
| 929 | + | |
929 | 930 | | |
930 | 931 | | |
931 | 932 | | |
| |||
1281 | 1282 | | |
1282 | 1283 | | |
1283 | 1284 | | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
1284 | 1288 | | |
1285 | 1289 | | |
1286 | 1290 | | |
| |||
1290 | 1294 | | |
1291 | 1295 | | |
1292 | 1296 | | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
1293 | 1300 | | |
1294 | 1301 | | |
1295 | 1302 | | |
| |||
1311 | 1318 | | |
1312 | 1319 | | |
1313 | 1320 | | |
1314 | | - | |
| 1321 | + | |
1315 | 1322 | | |
1316 | 1323 | | |
1317 | 1324 | | |
1318 | 1325 | | |
| 1326 | + | |
1319 | 1327 | | |
1320 | 1328 | | |
1321 | 1329 | | |
| |||
0 commit comments