Skip to content

Commit

Permalink
Always steal
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Cornu committed Oct 23, 2024
1 parent b9f5af1 commit 4819f04
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/nrnpython/nrnpy_p2h.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ static void py2n_component(Object* ob, Symbol* sym, int nindex, int isfunc) {
// for this to be a VAR. It is possible for it to
// be an Object but the GetItem below will raise
// TypeError: list indices must be integers or slices, not hoc.HocObject
arg = nb::borrow(nrnpy_hoc_pop("nindex py2n_component"));
arg = nb::steal(nrnpy_hoc_pop("nindex py2n_component"));

Check warning on line 229 in src/nrnpython/nrnpy_p2h.cpp

View check run for this annotation

Codecov / codecov/patch

src/nrnpython/nrnpy_p2h.cpp#L229

Added line #L229 was not covered by tests
}
result = PyObject_GetItem(tail, arg.ptr());
if (!result) {
Expand Down Expand Up @@ -464,11 +464,11 @@ static double func_call(Object* ho, int narg, int* err) {

nb::list args{};
for (int i = 0; i < narg; ++i) {
PyObject* item = nrnpy_hoc_pop("func_call");
if (item == NULL) {
nb::object item = nb::steal(nrnpy_hoc_pop("func_call"));
if (!item) {
hoc_execerror("nrnpy_hoc_pop failed", 0);
}
args.append(nb::borrow(item));
args.append(item);
}
args.reverse();

Expand Down

0 comments on commit 4819f04

Please sign in to comment.