Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9f2e0d6

Browse files
committed
merge with 3.4
2 parents 2f5f290 + 72a7f7c commit 9f2e0d6

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Lib/test/support/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,12 @@ def check_valid_file(fn):
10291029
requires('urlfetch')
10301030

10311031
print('\tfetching %s ...' % url, file=get_original_stdout())
1032-
f = urllib.request.urlopen(url, timeout=15)
1032+
opener = urllib.request.build_opener()
1033+
if gzip:
1034+
opener.addheaders.append(('Accept-Encoding', 'gzip'))
1035+
f = opener.open(url, timeout=15)
1036+
if gzip and f.headers.get('Content-Encoding') == 'gzip':
1037+
f = gzip.GzipFile(fileobj=f)
10331038
try:
10341039
with open(fn, "wb") as out:
10351040
s = f.read()

0 commit comments

Comments
 (0)