From 824944629400edbb4d6e9add661d7d3486527823 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Fri, 20 Jul 2018 10:44:38 +0700 Subject: [PATCH 1/3] .travis.yml: Update pypy jobs Remove pypy-5.3 as it has been deleted by Travis. Add pypy3.5-5.8.0 - 5.10.1 which have been added by Travis. --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 29f1d441..ad97b4a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,9 @@ python: - 3.6 - nightly - pypy - - pypy-5.3 + - pypy3.5-5.8.0 + - pypy3.5-5.9.0 + - pypy3.5-5.10.1 - pypy3 install: - pip install --upgrade . From 38f7089af757a181234dfddfc84f146fe52968ee Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Fri, 20 Jul 2018 10:23:06 +0700 Subject: [PATCH 2/3] Disable doctest error line offset on PyPy 6.0 The line offset is no longer needed on PyPy 6.0 Fixes https://github.com/PyCQA/pyflakes/issues/346 --- pyflakes/checker.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyflakes/checker.py b/pyflakes/checker.py index 1c30dda5..b820ffff 100644 --- a/pyflakes/checker.py +++ b/pyflakes/checker.py @@ -13,9 +13,10 @@ PY2 = sys.version_info < (3, 0) PY34 = sys.version_info < (3, 5) # Python 2.7 to 3.4 try: - sys.pypy_version_info + PYPY_VERSION = sys.pypy_version_info PYPY = True except AttributeError: + PYPY_VERSION = None PYPY = False builtin_vars = dir(__import__('__builtin__' if PY2 else 'builtins')) @@ -951,7 +952,7 @@ def handleDoctests(self, node): tree = compile(example.source, "", "exec", ast.PyCF_ONLY_AST) except SyntaxError: e = sys.exc_info()[1] - if PYPY: + if PYPY and PYPY_VERSION < (6, ): e.offset += 1 position = (node_lineno + example.lineno + e.lineno, example.indent + 4 + (e.offset or 0)) From 5afc4b01941f13bb82741f10e04168e47225f2da Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Fri, 20 Jul 2018 10:21:35 +0700 Subject: [PATCH 3/3] test_api.py: Adjust error offsets for PyPy 5.10 --- pyflakes/test/test_api.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pyflakes/test/test_api.py b/pyflakes/test/test_api.py index 56ca269a..b833674f 100644 --- a/pyflakes/test/test_api.py +++ b/pyflakes/test/test_api.py @@ -26,9 +26,10 @@ unichr = chr try: - sys.pypy_version_info + PYPY_VERSION = sys.pypy_version_info PYPY = True except AttributeError: + PYPY_VERSION = None PYPY = False try: @@ -483,6 +484,10 @@ def foo(bar=baz, bax): sourcePath = self.makeTempFile(source) last_line = ' ^\n' if ERROR_HAS_LAST_LINE else '' column = '8:' if ERROR_HAS_COL_NUM else '' + if PYPY and PYPY_VERSION >= (5, 10): + column = '7:' + last_line = last_line[1:] + self.assertHasErrors( sourcePath, ["""\ @@ -502,6 +507,9 @@ def test_nonKeywordAfterKeywordSyntaxError(self): sourcePath = self.makeTempFile(source) last_line = ' ^\n' if ERROR_HAS_LAST_LINE else '' column = '13:' if ERROR_HAS_COL_NUM or PYPY else '' + if PYPY and PYPY_VERSION >= (5, 10): + column = '12:' + last_line = last_line[1:] if sys.version_info >= (3, 5): message = 'positional argument follows keyword argument'