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 . 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)) 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'