[all-commits] [llvm/llvm-project] 9f5335: [mlir][python] Remove __str__ from bindings of Str...

Ingo Müller via All-commits all-commits at lists.llvm.org
Fri Sep 1 00:36:08 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9f5335487ae559a5f7976f1c3cb92ded2b123016
  Author: Ingo Müller <ingomueller at google.com>
  Date:   2023-09-01 (Fri, 01 Sep 2023)

  Changed paths:
    M mlir/lib/Bindings/Python/IRAttributes.cpp
    M mlir/test/python/dialects/builtin.py
    M mlir/test/python/ir/attributes.py

  Log Message:
  [mlir][python] Remove __str__ from bindings of StringAttr.

This reverts a feature introduced in commit
2a5d497494c24425e99655b85e2277dd3f15a400. The goal of that commit was to
allow `StringAttr`s to by used transparently wherever Python `str`s are
expected. But, as the tests in https://reviews.llvm.org/D159182 reveal,
pybind11 doesn't do this conversion based on `__str__` automatically,
unlike for the other types introduced in the commit above. At the same
time, changing `__str__` breaks the symmetry with other attributes of
`print(attr)` printing the assembly of the attribute, so the change
probably has more disadvantages than advantages.

Reviewed By: springerm, rkayaith

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

More information about the All-commits mailing list