I disable __builtins__ so no imports, exec, eval, open, etc. inside that context
but it seems you can still always do object.__subclasses__() and find every system method (eg. open())
it can't be overwritten but looking at the interpreter code is seems like it's possible to hack a workaround for this specific case.
are there other known ways to escape exec()?