Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b634a7b

Browse files
hydrogen602youknowone
authored andcommitted
added undocumented flags to flag validator
1 parent 3a5150a commit b634a7b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

vm/src/stdlib/ast.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,16 @@ pub(crate) fn compile(
358358
pub(crate) use _ast::NodeAst;
359359
// Used by builtins::compile()
360360
pub const PY_COMPILE_FLAG_AST_ONLY: i32 = 0x0400;
361+
362+
// The following flags match the values from Include/cpython/compile.h
363+
// Caveat emptor: These flags are undocumented on purpose and depending
364+
// on their effect outside the standard library is **unsupported**.
365+
const PY_CF_DONT_IMPLY_DEDENT: i32 = 0x200;
366+
const PY_CF_ALLOW_INCOMPLETE_INPUT: i32 = 0x4000;
367+
361368
// Used by builtins::compile() - the summary of all flags
362-
pub const PY_COMPILE_FLAGS_MASK: i32 = PY_COMPILE_FLAG_AST_ONLY;
369+
pub const PY_COMPILE_FLAGS_MASK: i32 =
370+
PY_COMPILE_FLAG_AST_ONLY | PY_CF_DONT_IMPLY_DEDENT | PY_CF_ALLOW_INCOMPLETE_INPUT;
363371

364372
pub fn make_module(vm: &VirtualMachine) -> PyRef<PyModule> {
365373
let module = _ast::make_module(vm);

0 commit comments

Comments
 (0)