This is an archive of the discontinued LLVM Phabricator instance.

[mlir][python] Remove __str__ from bindings of StringAttr.
ClosedPublic

Authored by ingomueller-net on Aug 31 2023, 1:08 AM.

Details

Summary

This reverts a feature introduced in commit
2a5d497494c24425e99655b85e2277dd3f15a400. The goal of that commit was to
allow StringAttrs to by used transparently wherever Python strs 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.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2023, 1:08 AM
ingomueller-net requested review of this revision.Aug 31 2023, 1:08 AM
springerm accepted this revision.Aug 31 2023, 4:05 AM
This revision is now accepted and ready to land.Aug 31 2023, 4:05 AM
  • Rebasing to current main to resolve unrelated CI failures.
rkayaith accepted this revision.Aug 31 2023, 7:07 AM

thanks for following up on this!

  • Rebase to a version from yesterday with working Windows build.