[Mlir-commits] [mlir] [MLIR:Python] Fix race on PyOperations. (PR #139721)
Peter Hawkins
llvmlistbot at llvm.org
Tue May 13 07:49:06 PDT 2025
hawkinsp wrote:
> Granted this is now "impl^2" territory (since if we were to switch to shared linking you would be right) but maybe we can guard against breakage (the corresponding shower thought was "is there a way to provide a custom error message in the case that those symbols do fail to resolve").
>
> Ultimately I'm not opposed to copy-pasta - this is just ideation/brainstorming (I will closely review the changes to our code today).
I think that there are three possibilities here:
a) The nanobind authors agrees to add it as a nanobind API. We upgrade to that version of nanobind and life is good. This may force us to wait until the next release, even if approved.
Failing that, it's something explicitly private. We shouldn't use other people's private APIs since they can and will change them. This leaves:
b) copy-paste, as this PR does now
c) send a PR adding `PyUnstable_TryIncRef` to `pythoncapi-compat`, which is a project that exists for this purpose, add it as an MLIR:Python build dependency, and then just write `PyUnstable_TryIncRef` in this code.
What do you think?
https://github.com/llvm/llvm-project/pull/139721
More information about the Mlir-commits
mailing list