GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Windows single-file mailbox rewrite can remove the mailbox when the fallback rename fails · Issue #156699 · python/cpython Open Labels OS-windowsstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-emailtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug reportBug descriptionSummaryOn Windows, The affected mailbox classes are Reproduction Codeimport errno import glob import mailbox import os import tempfile from unittest.mock import patch with tempfile.TemporaryDirectory() as directory: path = os.path.join(directory, "mailbox") box = mailbox.mbox(path) first = box.add(b"Subject: first\n\nfirst\n") box.add(b"Subject: second\n\nsecond\n") box.flush() box.remove(first) # Simulate Windows rejecting the first replacement attempt, followed by # an I/O failure while the fallback performs its second rename. with patch( "mailbox.os.rename", side_effect=[ FileExistsError(errno.EEXIST, "target exists"), OSError(errno.EIO, "injected second rename failure"), ], ): try: box.flush() except OSError as error: print("flush:", type(error).__name__, error.errno) print("mailbox exists:", os.path.exists(path)) print( "temporary files:", [os.path.basename(name) for name in glob.glob(path + ".*")], ) Observed on a Windows CPython build: Actual BehaviorAfter the first The rewritten temporary file normally remains, but the mailbox is no longer available at its original pathname. Expected BehaviorIf replacement of the rewritten mailbox fails, the original mailbox pathname should remain intact. Replacing an existing mailbox should not require explicitly removing the destination before installing the rewritten file. CPython versions tested onCPython main branch Operating systems tested onWindows Linked PRsReacted by Thomas Jakway Activity
MetadataMetadataAssigneesLabelsOS-windowsstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-emailtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |