Skip to content

Commit d0a5b2c

Browse files
committed
Some bugfix
1 parent ac9b768 commit d0a5b2c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

include/pyoptinterface/nleval.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ struct NonlinearEvaluator
182182
struct GraphHashes
183183
{
184184
std::vector<GraphHash> hashes;
185-
size_t n_hashes_since_last_aggregation;
185+
size_t n_hashes_since_last_aggregation = 0;
186186
} constraint_graph_hashes, objective_graph_hashes;
187187

188188
// length = n_graph_instances

lib/core_ext.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ NB_MODULE(core_ext, m)
103103

104104
return expr;
105105
},
106-
nb::arg("coefficients"), nb::arg("variables"))
106+
nb::arg("coefficients"), nb::arg("variables"),
107+
nb::rv_policy::take_ownership)
107108
.def_static(
108109
"from_numpy",
109110
[](CoeffNdarrayT coefficients, IndexNdarrayT variables, CoeffT constant) {
@@ -124,7 +125,8 @@ NB_MODULE(core_ext, m)
124125

125126
return expr;
126127
},
127-
nb::arg("coefficients"), nb::arg("variables"), nb::arg("constant"))
128+
nb::arg("coefficients"), nb::arg("variables"), nb::arg("constant"),
129+
nb::rv_policy::take_ownership)
128130

129131
.def(nb::init<const ExprBuilder &>())
130132
.def_ro("coefficients", &ScalarAffineFunction::coefficients)

0 commit comments

Comments
 (0)