STINNER Victor <[email protected]> added the comment:
Test leaking a temporary file in test_urllib:
test.test_urllib.urlretrieve_HttpTests.test_short_content_raises_ContentTooShortError_without_reporthook
I'm not sure of my fix:
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index f6ce9cb6d5..fdddd6e2d8 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -283,6 +283,7 @@ def urlretrieve(url, filename=None, reporthook=None,
data=None):
reporthook(blocknum, bs, size)
if size >= 0 and read < size:
+ urlcleanup()
raise ContentTooShortError(
"retrieval incomplete: got only %i out of %i bytes"
% (read, size), result)
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37421>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com