Skip to content

Commit

Permalink
bpo-37072: Fix crash in PyAST_FromNodeObject() when flags is NULL (py…
Browse files Browse the repository at this point in the history
…thon#13634)

I'm confident that this fixes the reported crash. flags=NULL is treated as using the latest minor version.

https://bugs.python.org/issue37072
  • Loading branch information
gvanrossum authored May 28, 2019
1 parent 44bfff2 commit 77f0ed7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix crash in PyAST_FromNodeObject() when flags is NULL.
2 changes: 1 addition & 1 deletion Python/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ PyAST_FromNodeObject(const node *n, PyCompilerFlags *flags,
/* borrowed reference */
c.c_filename = filename;
c.c_normalize = NULL;
c.c_feature_version = flags->cf_feature_version;
c.c_feature_version = flags ? flags->cf_feature_version : PY_MINOR_VERSION;

if (TYPE(n) == encoding_decl)
n = CHILD(n, 0);
Expand Down

0 comments on commit 77f0ed7

Please sign in to comment.