python3Packages.stim: fix build with pybind11 3.0

(cherry picked from commit f6ce4ceeec)
This commit is contained in:
Harinn
2026-05-23 20:07:34 +07:00
committed by github-actions[bot]
parent 1a76d54453
commit 63e3952d1f
2 changed files with 16 additions and 0 deletions

View File

@@ -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 \

View File

@@ -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) {