-
Notifications
You must be signed in to change notification settings - Fork 181
Closed
Labels
Description
I'm moving #90 (comment) here since we have GitHub issue support now.
It looks like the CPython 3.7 failure is related to a change in the AST. The docstring is no longer in node.body
.
We can mostly replace our getDocstring(node.body[0])
call with node.docstring
. But I'm not sure how to get the line number of the docstring anymore. node.lineno
is close, but not quite the line number of the docstring.
Line 873 in 074c21d
(docstring, node_lineno) = self.getDocstring(node.body[0]) |
diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 382574e..2c19533 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -870,7 +870,11 @@ class Checker(object):
def handleDoctests(self, node):
try:
- (docstring, node_lineno) = self.getDocstring(node.body[0])
+ if hasattr(node, 'docstring'):
+ docstring = node.docstring
+ node_lineno = ??? # TODO
+ 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
I've reported this to the CPython issue tracker.
sigmavirus24