aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2025-08-05 19:21:36 -0700
committerGitHub <noreply@github.com>2025-08-05 19:21:36 -0700
commit7b8dea265e72c3037b6b1e54d5ab51b7e14f328b (patch)
treeeb41d9afe8465bac057d10782c6d75312aca03f8 /lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h
parentd27802a2173ab3d864d3bf1ac507a4acc656e457 (diff)
downloadllvm-7b8dea265e72c3037b6b1e54d5ab51b7e14f328b.zip
llvm-7b8dea265e72c3037b6b1e54d5ab51b7e14f328b.tar.gz
llvm-7b8dea265e72c3037b6b1e54d5ab51b7e14f328b.tar.bz2
[lldb] Workaround omission of PyBUF_READ in the stable API (#152214)
PyMemoryView_FromMemory is part of stable ABI but the flag constants such as PyBUF_READ are not. This was fixed in Python 3.11 [1], but still requires this workaround when using older versions. [1] https://github.com/python/cpython/issues/98680
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h')
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h b/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h
index 9b4a1dd..0c28179 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h
@@ -60,6 +60,12 @@ static llvm::Expected<bool> *g_fcxx_modules_workaround [[maybe_unused]];
// with a version of Python we don't support.
static_assert(PY_VERSION_HEX >= LLDB_MINIMUM_PYTHON_VERSION,
"LLDB requires at least Python 3.8");
+
+// PyMemoryView_FromMemory is part of stable ABI but the flag constants are not.
+// See https://github.com/python/cpython/issues/98680
+#ifndef PyBUF_READ
+#define PyBUF_READ 0x100
+#endif
#endif
#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H