Commit 433b899
committed
Separate pdf finalization from closing
If an error is raised and the object state is inconsistent,
we shouldn't try to finalize the file, just close all resources.
The idea is to support the following idiom:
try:
figure.draw(file) # write pdf file, can raise
file.finalize() # do this if everything went well
finally:
file.close() # do this in any case1 parent 77ad3ef commit 433b899
1 file changed
Lines changed: 12 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
552 | 552 | | |
553 | 553 | | |
554 | 554 | | |
555 | | - | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
556 | 558 | | |
557 | | - | |
558 | 559 | | |
559 | 560 | | |
560 | 561 | | |
| |||
582 | 583 | | |
583 | 584 | | |
584 | 585 | | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
585 | 591 | | |
586 | 592 | | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | 593 | | |
| 594 | + | |
| 595 | + | |
591 | 596 | | |
592 | 597 | | |
593 | 598 | | |
| |||
2438 | 2443 | | |
2439 | 2444 | | |
2440 | 2445 | | |
| 2446 | + | |
2441 | 2447 | | |
2442 | 2448 | | |
2443 | 2449 | | |
| |||
2534 | 2540 | | |
2535 | 2541 | | |
2536 | 2542 | | |
| 2543 | + | |
2537 | 2544 | | |
2538 | 2545 | | |
2539 | 2546 | | |
| |||
0 commit comments