In _compile_restricted_mode when passing policy!=None only str and ast.Module are allowed. In the documentation, str, unicode string, and ast.AST. I suggest allowing bytes and bytearray (ReadableBuffer), ast.Interactive and ast.Expression. ast.Interactive and ast.Expression can already be obtained after asr.parse so the security will not change. And ReadableBuffer will be handled the same way as str.
In _compile_restricted_mode when passing policy!=None only str and ast.Module are allowed. In the documentation, str, unicode string, and ast.AST. I suggest allowing bytes and bytearray (ReadableBuffer), ast.Interactive and ast.Expression. ast.Interactive and ast.Expression can already be obtained after
asr.parseso the security will not change. And ReadableBuffer will be handled the same way as str.