[all-commits] [llvm/llvm-project] 1a940b: [mlir][py] Fix nanobind uninitialized values (#148...
Jordan Rupprecht via All-commits
all-commits at lists.llvm.org
Tue Jul 15 13:32:47 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 1a940bfff9176fb38a71b0045d7ae25df9a4ca7d
https://github.com/llvm/llvm-project/commit/1a940bfff9176fb38a71b0045d7ae25df9a4ca7d
Author: Jordan Rupprecht <rupprecht at google.com>
Date: 2025-07-15 (Tue, 15 Jul 2025)
Changed paths:
M mlir/include/mlir/Bindings/Python/NanobindAdaptors.h
Log Message:
-----------
[mlir][py] Fix nanobind uninitialized values (#148944)
After #143866, we no longer always write to `value`, causing it to be
uninitialized. This can lead to mysterious crashes, e.g. in
`python_test.py` / `testCustomAttribute` when we attempt to evaluate
`TestAttr(42)`, it does not set `value`, but
`mlirAttributeIsNull(value)` happens to return false for garbage memory,
and we end up trying to interpret it as a function instead of skipping
it.
Fix this by only reading `value` if it has been assigned. If it hasn't,
`return false` seems the right choice for all these methods, i.e.
indicate that `from_python` failed.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list