Skip to content

Commit f3e1d60

Browse files
authored
Merge branch 'master' into mh-fix-846-multiplication
2 parents 795b780 + 886ab82 commit f3e1d60

2 files changed

Lines changed: 14 additions & 12 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

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import os
1616
import re
17+
import runpy
1718
import sys
1819
import shutil
1920
import platform
@@ -131,8 +132,9 @@ def build_extension(self, ext):
131132
# README file as long_description.
132133
long_description = open("README.md", encoding="utf-8").read()
133134

134-
__version__ = ""
135-
exec(open("qsimcirq/_version.py").read())
135+
__version__ = runpy.run_path("qsimcirq/_version.py")["__version__"]
136+
if not __version__:
137+
raise ValueError("Version string cannot be empty")
136138

137139
setup(
138140
name="qsimcirq",

0 commit comments

Comments
 (0)