Decode retrieved files as UTF-8 even on Python 2

Python 2.7 is likely the only Python 2 anyone is using any longer
(even that's well past EOL upstream now), and reasonably recent
versions of 2.7 it need the same decode hack as Python 3 anyway when
dealing with some retrieved content. Just get rid of the version
detection and do it under any version.
This commit is contained in:
Jeremy Stanley
2020-05-31 00:17:36 +00:00
parent fd4b0ae5b2
commit 5515f756d4

View File

@@ -222,8 +222,7 @@ def get_uri(
dcache_fd.close() dcache_fd.close()
else: else:
try: try:
if pyversion("3"): data = urlopen(uri).read().decode("utf-8") data = urlopen(uri).read().decode("utf-8")
else: data = urlopen(uri).read()
except URLError: except URLError:
if ignore_fail: return "" if ignore_fail: return ""
else: else: