Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down
5 changes: 3 additions & 2 deletions pyflakes/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down Expand Up @@ -951,7 +952,7 @@ def handleDoctests(self, node):
tree = compile(example.source, "<doctest>", "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))
Expand Down
10 changes: 9 additions & 1 deletion pyflakes/test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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,
["""\
Expand All @@ -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'
Expand Down