aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api
diff options
context:
space:
mode:
authorJorge Gorbe Moya <jgorbe@google.com>2023-03-21 15:30:32 -0700
committerJorge Gorbe Moya <jgorbe@google.com>2023-03-22 11:28:52 -0700
commit984354fbbe4e207798f6d83c6f46b7603952dd36 (patch)
treec5447e7871e987ab9835a73a955b72177c1e4cf0 /lldb/test/API/python_api
parentead9644684e85e0611f3b0ff72926820f1277e09 (diff)
downloadllvm-984354fbbe4e207798f6d83c6f46b7603952dd36.zip
llvm-984354fbbe4e207798f6d83c6f46b7603952dd36.tar.gz
llvm-984354fbbe4e207798f6d83c6f46b7603952dd36.tar.bz2
[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
Diffstat (limited to 'lldb/test/API/python_api')
-rw-r--r--lldb/test/API/python_api/sbdata/TestSBData.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/lldb/test/API/python_api/sbdata/TestSBData.py b/lldb/test/API/python_api/sbdata/TestSBData.py
index 932781b..ba83959 100644
--- a/lldb/test/API/python_api/sbdata/TestSBData.py
+++ b/lldb/test/API/python_api/sbdata/TestSBData.py
@@ -387,12 +387,13 @@ class SBDataAPICase(TestBase):
self.assert_data(data2.GetUnsignedInt8, 4, 111)
self.assert_data(data2.GetUnsignedInt8, 5, 33)
- data2.SetDataFromUInt64Array([1, 2, 3, 4, 5])
+ data2.SetDataFromUInt64Array([1, 2, 3, 4, 5, 2**63])
self.assert_data(data2.GetUnsignedInt64, 0, 1)
self.assert_data(data2.GetUnsignedInt64, 8, 2)
self.assert_data(data2.GetUnsignedInt64, 16, 3)
self.assert_data(data2.GetUnsignedInt64, 24, 4)
self.assert_data(data2.GetUnsignedInt64, 32, 5)
+ self.assert_data(data2.GetUnsignedInt64, 40, 2**63)
self.assertEqual(
data2.uint64[0], 1,