From 2951521abc39f98236543db96e5850e00674b788 Mon Sep 17 00:00:00 2001 From: Nyakku Shigure Date: Wed, 16 Aug 2023 18:09:53 +0800 Subject: [PATCH] [SOT] eval frame skipping the generator in python 3.11 (#56262) Co-authored-by: xiongkun --- paddle/fluid/pybind/jit.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/paddle/fluid/pybind/jit.cc b/paddle/fluid/pybind/jit.cc index 7a3ae85e200..a0e130f40cf 100644 --- a/paddle/fluid/pybind/jit.cc +++ b/paddle/fluid/pybind/jit.cc @@ -206,6 +206,9 @@ static PyObject *_custom_eval_frame(PyThreadState *tstate, // _PyFrame_GetFrameObject(frame) # this function should be the right answer, // but nm libpython.so | grep _PyFrame_MakeAndSetFrameObject is a `t' symbol, // which means it's local to library. we will get a link error if we use it. + if (frame->owner == FRAME_OWNED_BY_GENERATOR) { + return eval_frame_default(tstate, frame, throw_flag); + } if (PyFrame_FastToLocalsWithError(Paddle_PyFrame_GetFrameObject(frame)) < 0) { #else if (PyFrame_FastToLocalsWithError(frame) < 0) { -- GitLab