Commit 1a4b1af 1 parent 9ccce80 commit 1a4b1af Copy full SHA for 1a4b1af
File tree 2 files changed +3
-0
lines changed
2 files changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -314,6 +314,7 @@ def __init__(
314
314
315
315
if isinstance (stream , (str , Path )):
316
316
stream = open (stream , "rb" ) # noqa: SIM115
317
+ # Wish I could just close stream in __del__ but that fails a test very strangely
317
318
weakref .finalize (self , stream .close )
318
319
319
320
self .read (stream )
Original file line number Diff line number Diff line change @@ -1234,6 +1234,7 @@ def test_set_page_label(pdf_file_path):
1234
1234
writer .set_page_label (0 , 1 , "/A" )
1235
1235
writer .write (pdf_file_path )
1236
1236
assert PdfReader (pdf_file_path ).page_labels [: len (expected )] == expected
1237
+ del writer
1237
1238
1238
1239
pdf_file_path .unlink ()
1239
1240
@@ -1477,6 +1478,7 @@ def test_update_form_fields(tmp_path):
1477
1478
)
1478
1479
1479
1480
writer .write (write_data_here )
1481
+ del writer
1480
1482
reader = PdfReader (write_data_here )
1481
1483
flds = reader .get_fields ()
1482
1484
assert flds ["CheckBox1" ]["/V" ] == "/Yes"
You can’t perform that action at this time.
0 commit comments