This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients Eugene Viktorov, SilentGhost, eryksun, martin.panter, terry.reedy, vstinner
Date 2016-02-20.03:55:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1455940550.73.0.712086764938.issue26385@psf.upfronthosting.co.za>
In-reply-to
Content
Eryk Sun: The patch proposes to add an unlink() call after the file has been closed:

except Exception:
    _os.close(fd)  # This automatically deletes the file right?
    _os.unlink(name)  # Won’t this raise FileNotFoundError?
    raise

By your explanation, it sounds like it would be better to call unlink() before close().

Terry & Victor: Writing the explicit “except BaseException:” makes it clear you weren’t being lazy in figuring out what exceptions you want to catch. But in this case the “raise” at the end of the the exception handler make it clear enough for me. I would be happy with either option.
History
Date User Action Args
2016-02-20 03:55:50martin.pantersetrecipients: + martin.panter, terry.reedy, vstinner, SilentGhost, eryksun, Eugene Viktorov
2016-02-20 03:55:50martin.pantersetmessageid: <1455940550.73.0.712086764938.issue26385@psf.upfronthosting.co.za>
2016-02-20 03:55:50martin.panterlinkissue26385 messages
2016-02-20 03:55:50martin.pantercreate