From: Debian Science Maintainers Date: Sat, 2 Mar 2019 14:59:35 +0000 (+0000) Subject: Make the datasets cache work in Python 3 X-Git-Tag: archive/raspbian/0.11.1-2+rpi1~2^2^2~11 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=50bce0a502e83e8f72ac65431d9f80d2bfc06a29;p=statsmodels.git Make the datasets cache work in Python 3 Fixes URLError messages appearing in the built documentation Author: Rebecca N. Palmer Forwarded: not-needed (upstream fixed this in _cache_it instead) Gbp-Pq: Name python3_dataset_caching.patch --- diff --git a/statsmodels/datasets/utils.py b/statsmodels/datasets/utils.py index b5a223d..0d87595 100644 --- a/statsmodels/datasets/utils.py +++ b/statsmodels/datasets/utils.py @@ -183,8 +183,8 @@ def _open_cache(cache_path): # Python 3 build import zlib data = zlib.decompress(open(cache_path, 'rb').read()) - # return as bytes object encoded in utf-8 for cross-compat of cached - data = cPickle.loads(data).encode('utf-8') + # treat Python 2 strings as bytes for cross-compat of cached + data = cPickle.loads(data, encoding='bytes') else: data = open(cache_path, 'rb').read().decode('zip') data = cPickle.loads(data)