Enable CodeHook use strict mode

This commit is contained in:
liangzhibo 2024-02-29 16:00:52 +08:00 committed by r1chardf1d0
parent 1c8c194ab7
commit c9b5650a0f
2 changed files with 2 additions and 2 deletions

View File

@ -1402,7 +1402,9 @@ PyObject *EvalFrame(PyThreadState *tstate, PyFrameObject *f, int exc) {
}
py::object res;
try {
common::SetEnv("MS_DEV_JIT_SYNTAX_LEVEL", "0");
res = CodeHook(tstate, c, f);
common::SetEnv("MS_DEV_JIT_SYNTAX_LEVEL", "2");
} catch (py::error_already_set &e) {
MS_LOG(ERROR) << "execute failed with " << e.what() << " at "
<< std::string(py::str(reinterpret_cast<PyObject *>(f->f_code)));

View File

@ -1082,9 +1082,7 @@ py::object MindCodeBreakGenerator::MakeCopyCode(const std::string &co_name, int
}
phase += ".pi_jit";
MindCompiler::CompileInfo compile_info{co_name, co_argcount, co_kwonlyargcount, co_flags};
common::SetEnv("MS_DEV_JIT_SYNTAX_LEVEL", "0");
CallableGraph callable = mindspore::pijit::MindCompiler::Compile(func_graph, args, py::dict(), phase, compile_info);
common::SetEnv("MS_DEV_JIT_SYNTAX_LEVEL", "2");
// Set NativeFunc.
auto parent = getJitCompileResults(reinterpret_cast<PyObject *>(co_), false);
if (make_graph) {