mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
Python: Move framework tests out of experimental
Since they are not experimental anymore 😄
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
# without this, `eval("print(42)")` becomes invalid syntax in Python 2, since print is a
|
||||
# statement
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
|
||||
if sys.version_info[0] == 3:
|
||||
import builtins
|
||||
if sys.version_info[0] == 2:
|
||||
import __builtin__ as builtins
|
||||
|
||||
exec("print(42)") # $getCode="print(42)"
|
||||
eval("print(42)") # $getCode="print(42)"
|
||||
|
||||
builtins.eval("print(42)") # $getCode="print(42)"
|
||||
|
||||
cmd = compile("print(42)", "<filename>", "exec")
|
||||
exec(cmd) # $getCode=cmd
|
||||
|
||||
cmd = builtins.compile("print(42)", "<filename>", "exec")
|
||||
exec(cmd) # $getCode=cmd
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# taint related
|
||||
|
||||
|
||||
def test_additional_taint():
|
||||
src = TAINTED_STRING
|
||||
|
||||
cmd1 = compile(src, "<filename>", "exec")
|
||||
cmd2 = compile(source=src, filename="<filename>", mode="exec")
|
||||
cmd3 = builtins.compile(src, "<filename>", "exec")
|
||||
|
||||
ensure_tainted(
|
||||
src,
|
||||
cmd1,
|
||||
cmd2,
|
||||
cmd3,
|
||||
)
|
||||
Reference in New Issue
Block a user