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 vstinner
Recipients vstinner, xtreak
Date 2019-07-01.18:01:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1562004108.37.0.0869622537038.issue37475@roundup.psfhosted.org>
In-reply-to
Content
While working on bpo-37421 "Some tests leak temporary files", I had to write PR 14529 fix: test_urllib urlretrieve() tests now explicitly call urlcleanup() to remove temporary files.

If urlretrieve() caller forgets to remove the temporary file, the "temporary" file is left in the temporary directory, until this directory is cleared which may happen soon (next reboot?) or not.

When ContentTooShortError is raised, the temporary file is left in the temporary directory: the caller must call urlcleanup() explicitly. It sounds like a bug to me.

Is it really a good API if urlcleanup() must be called explicitly? I dislike having a "separated" function for the cleanup, whereas Python could rely on object lifetime to do the cleanup.

Should we deprecate this API in favor of a better urllib API?
History
Date User Action Args
2019-07-01 18:01:48vstinnersetrecipients: + vstinner, xtreak
2019-07-01 18:01:48vstinnersetmessageid: <1562004108.37.0.0869622537038.issue37475@roundup.psfhosted.org>
2019-07-01 18:01:48vstinnerlinkissue37475 messages
2019-07-01 18:01:47vstinnercreate
Morty Proxy This is a proxified and sanitized view of the page, visit original site.