This is an archive of the discontinued LLVM Phabricator instance.

[mlir][python] Fix issue in diagnostic note initialization
ClosedPublic

Authored by rkayaith on Jul 16 2022, 2:01 PM.

Details

Summary

Previously the elements of the notes tuple would be invalid objects when
accessed from a diagnostic handler, resulting in a segfault when used.

Diff Detail

Event Timeline

rkayaith created this revision.Jul 16 2022, 2:01 PM
rkayaith added inline comments.Jul 16 2022, 2:05 PM
mlir/lib/Bindings/Python/IRCore.cpp
788

I'm not super familar with what pybind is doing here, but I believe the primary difference is that it will increment the ref count of the tuple element, which wasn't being done previously: https://github.com/pybind/pybind11/blob/59f03ee389c283cde65bd800c8f32ea690daf3fd/include/pybind11/pytypes.h#L1013

rkayaith published this revision for review.Jul 16 2022, 2:07 PM
rkayaith added reviewers: stellaraccident, ftynse.
ftynse accepted this revision.Jul 20 2022, 5:00 AM
This revision is now accepted and ready to land.Jul 20 2022, 5:00 AM
rkayaith updated this revision to Diff 446970.Jul 22 2022, 1:48 PM

add missing CHECK-LABEL

This revision was landed with ongoing or failed builds.Jul 22 2022, 1:56 PM
This revision was automatically updated to reflect the committed changes.