Skip to content

Commit a51b88a

Browse files
JDevliegherekrishna2803
authored andcommitted
[lldb] Workaround omission of PyBUF_READ in the stable API (llvm#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] python/cpython#98680
1 parent 49061dd commit a51b88a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ static llvm::Expected<bool> *g_fcxx_modules_workaround [[maybe_unused]];
6060
// with a version of Python we don't support.
6161
static_assert(PY_VERSION_HEX >= LLDB_MINIMUM_PYTHON_VERSION,
6262
"LLDB requires at least Python 3.8");
63+
64+
// PyMemoryView_FromMemory is part of stable ABI but the flag constants are not.
65+
// See https://github.com/python/cpython/issues/98680
66+
#ifndef PyBUF_READ
67+
#define PyBUF_READ 0x100
68+
#endif
6369
#endif
6470

6571
#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H

0 commit comments

Comments
 (0)