Skip to content

Commit 9261c18

Browse files
authored
Fix #843: avoid non-constant format strings in pybind_main.cpp (#844)
1 parent ac0b4f0 commit 9261c18

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

pybind_interface/pybind_main.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ std::vector<std::complex<float>> qsim_simulate(const py::dict &options) {
370370
circuit = getCircuit(options);
371371
bitstrings = getBitstrings(options, circuit.num_qubits);
372372
} catch (const std::invalid_argument &exp) {
373-
IO::errorf(exp.what());
373+
IO::errorf("%s", exp.what());
374374
return {};
375375
}
376376

@@ -414,7 +414,7 @@ std::vector<std::complex<float>> qsim_simulate(const py::dict &options) {
414414
param.verbosity = parseOptions<unsigned>(options, "v\0");
415415
param.seed = parseOptions<unsigned>(options, "s\0");
416416
} catch (const std::invalid_argument &exp) {
417-
IO::errorf(exp.what());
417+
IO::errorf("%s", exp.what());
418418
return {};
419419
}
420420

@@ -439,7 +439,7 @@ std::vector<std::complex<float>> qtrajectory_simulate(const py::dict &options) {
439439
num_qubits = ncircuit.num_qubits;
440440
bitstrings = getBitstrings(options, num_qubits);
441441
} catch (const std::invalid_argument &exp) {
442-
IO::errorf(exp.what());
442+
IO::errorf("%s", exp.what());
443443
return {};
444444
}
445445

@@ -478,7 +478,7 @@ std::vector<std::complex<float>> qtrajectory_simulate(const py::dict &options) {
478478
param.verbosity = parseOptions<unsigned>(options, "v\0");
479479
seed = parseOptions<unsigned>(options, "s\0");
480480
} catch (const std::invalid_argument &exp) {
481-
IO::errorf(exp.what());
481+
IO::errorf("%s", exp.what());
482482
return {};
483483
}
484484

@@ -687,7 +687,7 @@ class SimulatorHelper {
687687
}
688688
} catch (const std::invalid_argument &exp) {
689689
// If this triggers, is_valid is false.
690-
IO::errorf(exp.what());
690+
IO::errorf("%s", exp.what());
691691
}
692692
}
693693

@@ -976,7 +976,7 @@ std::vector<unsigned> qsim_sample(const py::dict &options) {
976976
try {
977977
circuit = getCircuit(options);
978978
} catch (const std::invalid_argument &exp) {
979-
IO::errorf(exp.what());
979+
IO::errorf("%s", exp.what());
980980
return {};
981981
}
982982

@@ -1008,7 +1008,7 @@ std::vector<unsigned> qsim_sample(const py::dict &options) {
10081008
param.verbosity = parseOptions<unsigned>(options, "v\0");
10091009
param.seed = parseOptions<unsigned>(options, "s\0");
10101010
} catch (const std::invalid_argument &exp) {
1011-
IO::errorf(exp.what());
1011+
IO::errorf("%s", exp.what());
10121012
return {};
10131013
}
10141014

@@ -1042,7 +1042,7 @@ std::vector<unsigned> qtrajectory_sample(const py::dict &options) {
10421042
try {
10431043
ncircuit = getNoisyCircuit(options);
10441044
} catch (const std::invalid_argument &exp) {
1045-
IO::errorf(exp.what());
1045+
IO::errorf("%s", exp.what());
10461046
return {};
10471047
}
10481048

@@ -1077,7 +1077,7 @@ std::vector<unsigned> qtrajectory_sample(const py::dict &options) {
10771077
seed = parseOptions<unsigned>(options, "s\0");
10781078
param.collect_mea_stat = true;
10791079
} catch (const std::invalid_argument &exp) {
1080-
IO::errorf(exp.what());
1080+
IO::errorf("%s", exp.what());
10811081
return {};
10821082
}
10831083

@@ -1152,7 +1152,7 @@ std::vector<std::complex<float>> qsimh_simulate(const py::dict &options) {
11521152
param.max_fused_size = parseOptions<unsigned>(options, "f\0");
11531153
param.verbosity = parseOptions<unsigned>(options, "v\0");
11541154
} catch (const std::invalid_argument &exp) {
1155-
IO::errorf(exp.what());
1155+
IO::errorf("%s", exp.what());
11561156
return {};
11571157
}
11581158

0 commit comments

Comments
 (0)