[all-commits] [llvm/llvm-project] 984354: [lldb] Update some uses of Python2 API in typemaps.
Jorge Gorbe Moya via All-commits
all-commits at lists.llvm.org
Wed Mar 22 11:29:59 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 984354fbbe4e207798f6d83c6f46b7603952dd36
https://github.com/llvm/llvm-project/commit/984354fbbe4e207798f6d83c6f46b7603952dd36
Author: Jorge Gorbe Moya <jgorbe at google.com>
Date: 2023-03-22 (Wed, 22 Mar 2023)
Changed paths:
M lldb/bindings/python/python-typemaps.swig
M lldb/test/API/python_api/sbdata/TestSBData.py
Log Message:
-----------
[lldb] Update some uses of Python2 API in typemaps.
Python 3 doesn't have a distinction between PyInt and PyLong, it's all
PyLong now.
This also fixes a bug in SetNumberFromObject. This used to crash LLDB:
```
lldb -o "script data=lldb.SBData(); data.SetDataFromUInt64Array([2**63])"
```
The problem happened in the PyInt path:
```
if (PyInt_Check(obj))
number = static_cast<T>(PyInt_AsLong(obj));
```
when obj doesn't fit in a signed long, `PyInt_AsLong` would fail with
"OverflowError: Python int too large to convert to C long".
The existing long path does the right thing, as it will call
`PyLong_AsUnsignedLongLong` for uint64_t.
Differential Revision: https://reviews.llvm.org/D146590
More information about the All-commits
mailing list