[Mlir-commits] [mlir] 9df846b - [mlir][python] fix PyThreadState_GetFrame (#153325)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Aug 12 18:16:07 PDT 2025
Author: Maksim Levental
Date: 2025-08-13T01:16:04Z
New Revision: 9df846bf71a7935d3a798f275471bb59e9b27803
URL: https://github.com/llvm/llvm-project/commit/9df846bf71a7935d3a798f275471bb59e9b27803
DIFF: https://github.com/llvm/llvm-project/commit/9df846bf71a7935d3a798f275471bb59e9b27803.diff
LOG: [mlir][python] fix PyThreadState_GetFrame (#153325)
`PyThreadState_GetFrame` wasn't added until 3.9 (fixes currently failing
rocm builder)
Added:
Modified:
mlir/lib/Bindings/Python/IRCore.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Bindings/Python/IRCore.cpp b/mlir/lib/Bindings/Python/IRCore.cpp
index 1aec7ffe8e083..03b04ffbe9749 100644
--- a/mlir/lib/Bindings/Python/IRCore.cpp
+++ b/mlir/lib/Bindings/Python/IRCore.cpp
@@ -2786,6 +2786,14 @@ class PyOpAttributeMap {
PyOperationRef operation;
};
+// bpo-40429 added PyThreadState_GetFrame() to Python 3.9.0b1
+#if PY_VERSION_HEX < 0x030900B1 && !defined(PYPY_VERSION)
+static inline PyFrameObject *PyThreadState_GetFrame(PyThreadState *tstate) {
+ assert(tstate != _Py_NULL);
+ return _Py_CAST(PyFrameObject *, Py_XNewRef(tstate->frame));
+}
+#endif
+
MlirLocation tracebackToLocation(MlirContext ctx) {
size_t framesLimit =
PyGlobals::get().getTracebackLoc().locTracebackFramesLimit();
More information about the Mlir-commits
mailing list