1 /** 2 * Copyright 2024 Huawei Technologies Co., Ltd 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #define PY_SSIZE_T_CLEAN 17 #include <Python.h> 18 #if (PY_MAJOR_VERSION == 3) && (PY_MINOR_VERSION == 8) 19 #define Py_BUILD_CORE 20 // <stdatomic.h> is unsupported by g++ 21 #include <internal/pycore_pystate.h> 22 #undef Py_BUILD_CORE 23 #endif 24 25 #if (PY_MAJOR_VERSION == 3) && (PY_MINOR_VERSION < 9) 26 _PyInterpreterState_GetEvalFrameFunc(PyInterpreterState * state)27_PyFrameEvalFunction _PyInterpreterState_GetEvalFrameFunc(PyInterpreterState *state) { return state->eval_frame; } _PyInterpreterState_SetEvalFrameFunc(PyInterpreterState * state,_PyFrameEvalFunction eval_frame_function)28void _PyInterpreterState_SetEvalFrameFunc(PyInterpreterState *state, _PyFrameEvalFunction eval_frame_function) { 29 state->eval_frame = eval_frame_function; 30 } 31 32 #endif 33