summaryrefslogtreecommitdiff
path: root/Python/future.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-05-30 10:56:16 +0300
committerGitHub <noreply@github.com>2018-05-30 10:56:16 +0300
commit143ce5c6db77a0b9d451b8463dee6752358a9ea4 (patch)
tree06447cc4461c71aa7163c1b844e1a48ec266539c /Python/future.c
parente9537ad6a128924dd610bea2268065500c174181 (diff)
downloadcpython-git-143ce5c6db77a0b9d451b8463dee6752358a9ea4.tar.gz
bpo-33691: Add _PyAST_GetDocString(). (GH-7236)
Diffstat (limited to 'Python/future.c')
-rw-r--r--Python/future.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/Python/future.c b/Python/future.c
index 03a97c865a..4ea6827723 100644
--- a/Python/future.c
+++ b/Python/future.c
@@ -5,6 +5,7 @@
#include "graminit.h"
#include "code.h"
#include "symtable.h"
+#include "ast.h"
#define UNDEFINED_FUTURE_FEATURE "future feature %.100s is not defined"
#define ERR_LATE_FUTURE \
@@ -63,7 +64,6 @@ static int
future_parse(PyFutureFeatures *ff, mod_ty mod, PyObject *filename)
{
int i, done = 0, prev_line = 0;
- stmt_ty first;
if (!(mod->kind == Module_kind || mod->kind == Interactive_kind))
return 1;
@@ -80,11 +80,7 @@ future_parse(PyFutureFeatures *ff, mod_ty mod, PyObject *filename)
*/
i = 0;
- first = (stmt_ty)asdl_seq_GET(mod->v.Module.body, i);
- if (first->kind == Expr_kind
- && (first->v.Expr.value->kind == Str_kind
- || (first->v.Expr.value->kind == Constant_kind
- && PyUnicode_CheckExact(first->v.Expr.value->v.Constant.value))))
+ if (_PyAST_GetDocString(mod->v.Module.body) != NULL)
i++;
for (; i < asdl_seq_LEN(mod->v.Module.body); i++) {