python3Packages.stim: fix build with pybind11 3.0

This commit is contained in:
Harinn
2026-05-23 20:07:34 +07:00
parent 2bb5ecd583
commit f6ce4ceeec
2 changed files with 16 additions and 0 deletions
@@ -32,6 +32,11 @@ buildPythonPackage rec {
hash = "sha256-Wls7dJkuV/RXnMizwrYOJOKopWEf1r21FKoKHjmpEQ0=";
};
patches = [
# Fix measure_kickback lambda return type deduction under pybind11 3.0.
./fix-measure-kickback-lambda-return-type.patch
];
postPatch = ''
# asked to relax this in https://github.com/quantumlib/Stim/issues/623
substituteInPlace pyproject.toml \
@@ -0,0 +1,11 @@
--- a/src/stim/simulators/tableau_simulator.pybind.cc
+++ b/src/stim/simulators/tableau_simulator.pybind.cc
@@ -2287,7 +2287,7 @@
c.def(
"measure_kickback",
- [](TableauSimulator<MAX_BITWORD_WIDTH> &self, uint32_t target) {
+ [](TableauSimulator<MAX_BITWORD_WIDTH> &self, uint32_t target) -> pybind11::tuple {
self.ensure_large_enough_for_qubits(target + 1);
auto result = self.measure_kickback_z({target});
if (result.second.num_qubits == 0) {