[all-commits] [llvm/llvm-project] 023a98: [lldb] Add Pythonic API to SBStructuredData extens...

Dave Lee via All-commits all-commits at lists.llvm.org
Tue Sep 2 14:24:17 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 023a98c2ae8a260632f5fa71aaede95c4a981399
      https://github.com/llvm/llvm-project/commit/023a98c2ae8a260632f5fa71aaede95c4a981399
  Author: Dave Lee <davelee.com at gmail.com>
  Date:   2025-09-02 (Tue, 02 Sep 2025)

  Changed paths:
    M lldb/bindings/interface/SBStructuredDataExtensions.i
    M lldb/test/API/python_api/sbstructureddata/TestStructuredDataAPI.py

  Log Message:
  -----------
  [lldb] Add Pythonic API to SBStructuredData extension (#155061)

* Adds `dynamic` property to automatically convert `SBStructuredData`
instances to the associated Python type (`str`, `int`, `float`, `bool`,
`NoneType`, etc)
* Implements `__getitem__` for Pythonic array and dictionary
subscripting
  * Subscripting return the result of the `dynamic` property
* Updates `__iter__` to support dictionary instances (supporting `for`
loops)
* Adds conversion to `str`, `int`, and `float`
* Adds Pythonic `bool` conversion

With these changes, these two expressions are equal:

```py
data["name"] == data.GetValueForKey("name").GetStringValue(1024)
```

Additionally did some cleanup in TestStructuredDataAPI.py.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list