summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2025-03-17 20:48:54 (GMT)
committerGitHub <noreply@github.com>2025-03-17 20:48:54 (GMT)
commitffc2f1dd1c023b44b488311511db790a96d757db (patch)
tree6b64e44cd1c26723489d2e8c3224280495470991 /Python/pythonrun.c
parent468a7aaeb4dfcd21697dfa46362b9f415b9daf1b (diff)
downloadcpython-ffc2f1dd1c023b44b488311511db790a96d757db.zip
cpython-ffc2f1dd1c023b44b488311511db790a96d757db.tar.gz
cpython-ffc2f1dd1c023b44b488311511db790a96d757db.tar.bz2
gh-130080: implement PEP 765 (#130087)
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 41f2174..6e24131 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1495,11 +1495,10 @@ Py_CompileStringObject(const char *str, PyObject *filename, int start,
return NULL;
}
if (flags && (flags->cf_flags & PyCF_ONLY_AST)) {
- if ((flags->cf_flags & PyCF_OPTIMIZED_AST) == PyCF_OPTIMIZED_AST) {
- if (_PyCompile_AstOptimize(mod, filename, flags, optimize, arena) < 0) {
- _PyArena_Free(arena);
- return NULL;
- }
+ int syntax_check_only = ((flags->cf_flags & PyCF_OPTIMIZED_AST) == PyCF_ONLY_AST); /* unoptiomized AST */
+ if (_PyCompile_AstOptimize(mod, filename, flags, optimize, arena, syntax_check_only) < 0) {
+ _PyArena_Free(arena);
+ return NULL;
}
PyObject *result = PyAST_mod2obj(mod);
_PyArena_Free(arena);