[all-commits] [llvm/llvm-project] 89103b: [libc++] Fix GDB pretty printers when GDB uses Pyt...

Alexander Richardson via All-commits all-commits at lists.llvm.org
Wed Jan 19 02:12:40 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 89103bd2f06dea6dc89276cd12dd78c72476b03f
      https://github.com/llvm/llvm-project/commit/89103bd2f06dea6dc89276cd12dd78c72476b03f
  Author: Alex Richardson <alexrichardson at google.com>
  Date:   2022-01-19 (Wed, 19 Jan 2022)

  Changed paths:
    M libcxx/utils/gdb/libcxx/printers.py

  Log Message:
  -----------
  [libc++] Fix GDB pretty printers when GDB uses Python 2.7

The gdb_pretty_printer_test.sh fails if GDB was built against Python 2.7
since Python 2 expects iterators to have a next() method rather than
using __next__. To make the pretty printers work with both Python 2 and 3
we can simply set next to __next__ in the iterator classes.

Python 2.7 support was removed in f46f93b4786377dd7ee704ef2beedadfe4f05adf,
so this partially reverts that commit. While Python 2.7 is EOL, it
appears there are still many GDB installations that are linked against
Python 2.7, so we may want to keep this tiny amount of compat code
around for a while longer.

Without this commit the tests fails with errors such as:
```
GDB printed:
   u"std::tuple containingTypeError: iter() returned non-iterator of type '_Children'\n"
Value should match:
   u'std::tuple containing = {[1] = 2, [2] = 3, [3] = 4}'
```

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D117470




More information about the All-commits mailing list