@@ -105,13 +105,6 @@ void bindDecoder(nb::module_ &mod) {
105105 ? nb::cast<nb::module_>(mod.attr (" qecrt" ))
106106 : mod.def_submodule (" qecrt" );
107107
108- // Workaround for nanobind v2.9.2: `def_rw` on a `std::optional<T>` field
109- // does not implicitly allow Python `None` for the setter (that behavior was
110- // added in v2.12.0 via PR #1262). Passing this annotation makes the setter
111- // accept None and store `std::nullopt`. Remove once nanobind is bumped to
112- // >=2.12.0.
113- const auto setter_accepts_none = nb::for_setter (nb::arg (" value" ).none ());
114-
115108 nb::class_<decoder_result>(qecmod, " DecoderResult" , R"pbdoc(
116109 A class representing the results of a quantum error correction decoding operation.
117110
@@ -135,8 +128,7 @@ void bindDecoder(nb::module_ &mod) {
135128 the original quantum state. The format depends on the specific decoder
136129 implementation.
137130 )pbdoc" )
138- .def_rw (" opt_results" , &decoder_result::opt_results, setter_accepts_none,
139- R"pbdoc(
131+ .def_rw (" opt_results" , &decoder_result::opt_results, R"pbdoc(
140132 Optional additional results from the decoder stored in a heterogeneous map.
141133
142134 This field may be empty if no additional results are available.
@@ -741,10 +733,23 @@ void bindDecoder(nb::module_ &mod) {
741733 (error_msg ? std::string (error_msg) : " unknown error." )));
742734 }
743735
744- // List of `init_func` names to call for decoder registration
736+ // List of `init_func` names to call for decoder registration.
737+ //
738+ // The `enqueue_syndromes` mangled string encodes the public API's
739+ // parameter type. Under CUDA-Q alias `using measure_result =
740+ // measure_handle;`, C++ mangling resolves the typedef to its underlying
741+ // type, so `INS_14measure_handleESaIS3_EE` is the inner-vector mangling for
742+ // `std::vector<cudaq::measure_handle>`. If CUDA-Q ever renames the
743+ // underlying handle type or changes the alias direction, this string must
744+ // be re-derived from `nm` on the per-target device .o.
745+ //
746+ // `enqueue_syndromes_test` is the bool-typed counterpart and stays bound
747+ // to `INS_t6vectorIbSaIbEE`; the Python frontend hands it pre-discriminated
748+ // bits via `cudaq.to_bools(...)`.
745749 // clang-format off
746750 static const std::vector<std::string> initFuncNames = {
747- " function_enqueue_syndromes._ZN5cudaq3qec8decoding17enqueue_syndromesEmRKSt6vectorIbSaIbEEm.init_func" ,
751+ " function_enqueue_syndromes._ZN5cudaq3qec8decoding17enqueue_syndromesEmRKSt6vectorINS_14measure_handleESaIS3_EEm.init_func" ,
752+ " function_enqueue_syndromes_test._ZN5cudaq3qec8decoding22enqueue_syndromes_testEmRKSt6vectorIbSaIbEEm.init_func" ,
748753 " function_get_corrections._ZN5cudaq3qec8decoding15get_correctionsEmmb.init_func" ,
749754 " function_reset_decoder._ZN5cudaq3qec8decoding13reset_decoderEm.init_func" };
750755 // clang-format on
0 commit comments