safe_load
>>> yaml.safe_load("!!python/object/apply:os.system\nargs: ['echo hi']")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
...
yaml.constructor.ConstructorError: could not determine a constructor for the tag 'tag:yaml.org,2002:python/object/apply:os.system'
in "<unicode string>", line 1, column 1:
!!python/object/apply:os.system
^
yaml.safe_load
is pure pythonyaml.load(..., Loader=SafeLoader)
try:
from yaml.cyaml import CSafeLoader as Loader
except ImportError:
from yaml import SafeLoader as Loader
yaml.load(..., Loader=Loader)