diff options
author | Steven Myint <git@stevenmyint.com> | 2017-06-05 17:29:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-05 17:29:47 -0700 |
commit | 8baf19d9b7d0ebe31ae79017480752d26fde088a (patch) | |
tree | 3ce99438a362f695709dd882f85db352a7d3da8e | |
parent | 4e77dc65ca94d9dafd9e0b61dce4698e0346f83f (diff) | |
download | pyflakes-8baf19d9b7d0ebe31ae79017480752d26fde088a.tar.gz |
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 821a0694b1bdc61c53cc0ad20dbc1ed2bca0de7d
-rw-r--r-- | .travis.yml | 3 | ||||
-rw-r--r-- | pyflakes/checker.py | 14 |
2 files changed, 13 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml index 1ea3e20..2d614cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,9 +11,6 @@ python: - pypy-5.3 - pypy3 - pypy3.3-5.2-alpha1 -matrix: - allow_failures: - - python: nightly install: - pip install flake8==2.1.0 pep8==1.5.6 - python setup.py install diff --git a/pyflakes/checker.py b/pyflakes/checker.py index 382574e..75abdc0 100644 --- a/pyflakes/checker.py +++ b/pyflakes/checker.py @@ -870,7 +870,19 @@ class Checker(object): def handleDoctests(self, node): try: - (docstring, node_lineno) = self.getDocstring(node.body[0]) + if hasattr(node, 'docstring'): + docstring = node.docstring + + # This is just a reasonable guess. In Python 3.7, docstrings no + # longer have line numbers associated with them. This will be + # incorrect if there are empty lines between the beginning + # of the function and the docstring. + node_lineno = node.lineno + if hasattr(node, 'args'): + node_lineno = max([node_lineno] + + [arg.lineno for arg in node.args.args]) + else: + (docstring, node_lineno) = self.getDocstring(node.body[0]) examples = docstring and self._getDoctestExamples(docstring) except (ValueError, IndexError): # e.g. line 6 of the docstring for <string> has inconsistent |