From f6ce4ceeec8fbd3d5b12b3899568f377048eb905 Mon Sep 17 00:00:00 2001 From: Harinn Date: Sat, 23 May 2026 20:07:34 +0700 Subject: [PATCH] python3Packages.stim: fix build with pybind11 3.0 --- pkgs/development/python-modules/stim/default.nix | 5 +++++ .../fix-measure-kickback-lambda-return-type.patch | 11 +++++++++++ 2 files changed, 16 insertions(+) create mode 100644 pkgs/development/python-modules/stim/fix-measure-kickback-lambda-return-type.patch diff --git a/pkgs/development/python-modules/stim/default.nix b/pkgs/development/python-modules/stim/default.nix index 8df37c45ac8e..9818c2b3990a 100644 --- a/pkgs/development/python-modules/stim/default.nix +++ b/pkgs/development/python-modules/stim/default.nix @@ -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 \ diff --git a/pkgs/development/python-modules/stim/fix-measure-kickback-lambda-return-type.patch b/pkgs/development/python-modules/stim/fix-measure-kickback-lambda-return-type.patch new file mode 100644 index 000000000000..bf19652bfed3 --- /dev/null +++ b/pkgs/development/python-modules/stim/fix-measure-kickback-lambda-return-type.patch @@ -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 &self, uint32_t target) { ++ [](TableauSimulator &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) {