You don't even need a ctypes import for it, you'll get a segfault from this:
eval((lambda:0).__code__.replace(co_consts=()))
cpython is not memory safe. eval((lambda:0).__code__.replace(co_consts=()))
cpython is not memory safe.Containers are considered nearly sufficient to sandbox Python, which cannot be effectively sandboxed using Python itself. Isn't that actually true for all languages though?
There's a RustPython, but it does support CFFI and __builtins__.eval, so
def f(): pass
f.__code__ = f.__code__.replace(co_consts=())
f()