Skip to content

Commit 82b032d

Browse files
committed
Fix keepalives
1 parent d80b5a6 commit 82b032d

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/binding/python/Iteration.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ void init_Iteration(py::module &m)
101101
py::return_value_policy::copy,
102102
// garbage collection: return value must be freed before
103103
// Iteration
104-
py::keep_alive<1, 0>()))
104+
py::keep_alive<0, 1>()))
105105
.def_property_readonly(
106106
"particles",
107107
py::cpp_function(
108108
[](Iteration &i) { return i.particles; },
109109
py::return_value_policy::copy,
110110
// garbage collection: return value must be freed before
111111
// Iteration
112-
py::keep_alive<1, 0>()));
112+
py::keep_alive<0, 1>()));
113113

114114
add_pickle(
115115
cl, [](openPMD::Series series, std::vector<std::string> const &group) {

src/binding/python/ParticleSpecies.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void init_ParticleSpecies(py::module &m)
5454
[](ParticleSpecies &ps) { return ps.particlePatches; },
5555
py::return_value_policy::copy,
5656
// garbage collection: return value must be freed before Series
57-
py::keep_alive<1, 0>()));
57+
py::keep_alive<0, 1>()));
5858
add_pickle(
5959
cl, [](openPMD::Series series, std::vector<std::string> const &group) {
6060
uint64_t const n_it = std::stoull(group.at(1));

src/binding/python/Series.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ this method.
503503
[](Series &s) { return s.iterations; },
504504
py::return_value_policy::copy,
505505
// garbage collection: return value must be freed before Series
506-
py::keep_alive<1, 0>()))
506+
py::keep_alive<0, 1>()))
507507
.def(
508508
"read_iterations",
509509
[](Series &s) {

0 commit comments

Comments
 (0)