[Bug 44225] New: LLDB build error in llvmorg-9.0.1-rc1 with Python 2

Bug ID 44225
Summary LLDB build error in llvmorg-9.0.1-rc1 with Python 2
Product lldb
Version 9.0
Hardware PC
OS Linux
Status NEW
Severity release blocker
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter chrschn@google.com
CC jdevlieghere@apple.com, llvm-bugs@lists.llvm.org

LLDB fails to build against Python 2.X, I get the following error message:

/path/to/llvm-build/src/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp:52:25:
error: use of undeclared identifier 'PyMem_RawMalloc'; did you mean
'PyMem_Malloc'?
    char *ret = (char *)PyMem_RawMalloc(1);
                        ^~~~~~~~~~~~~~~
                        PyMem_Malloc
/path/to/llvm-build/workstation-sysroot/usr/include/python2.7/pymem.h:52:20:
note: 'PyMem_Malloc' declared here
PyAPI_FUNC(void *) PyMem_Malloc(size_t);
                   ^
/path/to/llvm-build/src/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp:60:23:
error: use of undeclared identifier 'PyMem_RawMalloc'; did you mean
'PyMem_Malloc'?
  char *ret = (char *)PyMem_RawMalloc(n + 2);
                      ^~~~~~~~~~~~~~~
                      PyMem_Malloc
/path/to/llvm-build/workstation-sysroot/usr/include/python2.7/pymem.h:52:20:
note: 'PyMem_Malloc' declared here
PyAPI_FUNC(void *) PyMem_Malloc(size_t);
                   ^
1 warning and 2 errors generated.

According to the Python documentation, PyMem_RawMalloc() was only introduced in
3.4: [https://docs.python.org/3/c-api/memory.html](https://docs.python.org/3/c-api/memory.html)

Looking at the cherry-picks between llvmorg-9.0.0-rc5 and llvmorg-9.0.1-rc1, I
suspect that this is caused by [https://reviews.llvm.org/D69793](https://reviews.llvm.org/D69793).

labath@google.com changed bug 44225

What Removed Added
Status NEW RESOLVED
Resolution FIXED

Comment # 1 on bug 44225 from labath@google.com

This was fixed by d5904988, and it looks like that commit was already
cherry-picked into the release branch (as 9b2d207cf) -- it just didn't make it
in time for rc1. The next release candidate should include it.

Closing this now, but if you do see this happening after rc2, then please do
reopen this bug.