From 259f571cb94d363c995603a97fd3d016639eb3bb Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Wed, 27 Feb 2019 08:43:33 -0800 Subject: [PATCH] Python 3.7 Support (#447) * py3.7 fixes: - add __repr__ to WBException for consistent output in py3.7 - don't raise StopIteration in generator, just return * ci: add py3.7 builds to travis and appveyor, (don't include in integration test suite for now) --- .travis.yml | 3 +++ appveyor.yml | 3 +++ pywb/utils/wbexception.py | 3 +++ pywb/warcserver/index/zipnum.py | 4 +--- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 65fd91ab..9d7835da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ python: - "2.7" - "3.5" - "3.6" + - "3.7" dist: xenial @@ -44,4 +45,6 @@ matrix: python: "2.7" - env: WR_TEST=yes python: "3.5" + - env: WR_TEST=yes + python: "3.7" diff --git a/appveyor.yml b/appveyor.yml index a86f065a..394e9b56 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,6 +9,9 @@ environment: - PYTHON: "C:\\Python35-x64" - PYTHON: "C:\\Python36" - PYTHON: "C:\\Python36-x64" + - PYTHON: "C:\\Python37" + - PYTHON: "C:\\Python37-x64" + install: - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" diff --git a/pywb/utils/wbexception.py b/pywb/utils/wbexception.py index 84c0712f..b7cd00da 100644 --- a/pywb/utils/wbexception.py +++ b/pywb/utils/wbexception.py @@ -7,6 +7,9 @@ class WbException(Exception): self.msg = msg self.url = url + def __repr__(self): + return "{0}('{1}',)".format(self.__class__.__name__, self.msg) + # Default Error Code # def status(self): # return '500 Internal Server Error' diff --git a/pywb/warcserver/index/zipnum.py b/pywb/warcserver/index/zipnum.py index 6037b2cd..63a348ae 100644 --- a/pywb/warcserver/index/zipnum.py +++ b/pywb/warcserver/index/zipnum.py @@ -214,9 +214,7 @@ class ZipNumIndexSource(BaseIndexSource): reader.close() if query.page_count: yield self._page_info(0, pagesize, 0) - return - else: - raise + return first = IDXObject(first_line)