gh-108113: Make it possible to create an optimized AST (#108154)

This commit is contained in:
Irit Katriel 2023-08-21 17:31:30 +01:00 committed by GitHub
parent 47022a079e
commit 10a91d7e98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 124 additions and 14 deletions

View file

@ -1208,6 +1208,9 @@ class ASTModuleVisitor(PickleVisitor):
self.emit('if (PyModule_AddIntMacro(m, PyCF_TYPE_COMMENTS) < 0) {', 1)
self.emit("return -1;", 2)
self.emit('}', 1)
self.emit('if (PyModule_AddIntMacro(m, PyCF_OPTIMIZED_AST) < 0) {', 1)
self.emit("return -1;", 2)
self.emit('}', 1)
for dfn in mod.dfns:
self.visit(dfn)
self.emit("return 0;", 1)