Skip to content

Commit 8baf19d

Browse files
authored
Support Python 3.7 (#273)
* Ignore temporary files * Support Python 3.7 This fixes #271. * Re-enable nightly in Travis CI This relates to #90. * Undo 821a069
1 parent 4e77dc6 commit 8baf19d

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ python:
1111
- pypy-5.3
1212
- pypy3
1313
- pypy3.3-5.2-alpha1
14-
matrix:
15-
allow_failures:
16-
- python: nightly
1714
install:
1815
- pip install flake8==2.1.0 pep8==1.5.6
1916
- python setup.py install

pyflakes/checker.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,19 @@ def handleNode(self, node, parent):
870870

871871
def handleDoctests(self, node):
872872
try:
873-
(docstring, node_lineno) = self.getDocstring(node.body[0])
873+
if hasattr(node, 'docstring'):
874+
docstring = node.docstring
875+
876+
# This is just a reasonable guess. In Python 3.7, docstrings no
877+
# longer have line numbers associated with them. This will be
878+
# incorrect if there are empty lines between the beginning
879+
# of the function and the docstring.
880+
node_lineno = node.lineno
881+
if hasattr(node, 'args'):
882+
node_lineno = max([node_lineno] +
883+
[arg.lineno for arg in node.args.args])
884+
else:
885+
(docstring, node_lineno) = self.getDocstring(node.body[0])
874886
examples = docstring and self._getDoctestExamples(docstring)
875887
except (ValueError, IndexError):
876888
# e.g. line 6 of the docstring for <string> has inconsistent

0 commit comments

Comments
 (0)