is_safe_compiler_arg#
- scikitplot.cython.is_safe_compiler_arg(arg, *, allow_shell_meta=False, allow_dangerous=False)[source]#
Return
Truewhen a compiler argument string is safe to pass.- Parameters:
- argstr
A single compiler flag (e.g.,
"-O2","-DNDEBUG").- allow_shell_metabool, default=False
If
False, shell metacharacters are rejected.- allow_dangerousbool, default=False
If
False, known-dangerous flag patterns are rejected.
- Returns:
- bool
Trueif the argument passes all checks,Falseotherwise.
- Parameters:
- Return type:
Notes
Null bytes are always rejected regardless of other flags.
Examples
>>> is_safe_compiler_arg("-O2") True >>> is_safe_compiler_arg("-O2; rm -rf /") False >>> is_safe_compiler_arg("-imacros /etc/shadow") False