Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ New features
- conda installable package
- GPU version

2.3.5 (upcoming)
==================

Bug fixes
---------
- Fix Python reference leak to results struct [#229]


2.3.4 (2019-07-21)
==================
This is a bug-fix release and contains general code quality improvements.
Expand Down
19 changes: 15 additions & 4 deletions mocks/python_bindings/_countpairs_mocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,10 @@ static PyObject *countpairs_countpairs_rp_pi_mocks(PyObject *self, PyObject *arg
rlow=results.rupp[i];
}
free_results_mocks(&results);
return Py_BuildValue("(Od)", ret, c_api_time);

PyObject *rettuple = Py_BuildValue("(Od)", ret, c_api_time);
Py_DECREF(ret); // transfer reference ownership to the tuple
return rettuple;
}

static PyObject *countpairs_countpairs_s_mu_mocks(PyObject *self, PyObject *args, PyObject *kwargs)
Expand Down Expand Up @@ -1726,7 +1729,10 @@ static PyObject *countpairs_countpairs_s_mu_mocks(PyObject *self, PyObject *args
rlow=results.supp[i];
}
free_results_mocks_s_mu(&results);
return Py_BuildValue("(Od)", ret, c_api_time);

PyObject *rettuple = Py_BuildValue("(Od)", ret, c_api_time);
Py_DECREF(ret); // transfer reference ownership to the tuple
return rettuple;
}

static PyObject *countpairs_countpairs_theta_mocks(PyObject *self, PyObject *args, PyObject *kwargs)
Expand Down Expand Up @@ -2015,7 +2021,10 @@ static PyObject *countpairs_countpairs_theta_mocks(PyObject *self, PyObject *arg
rlow=results.theta_upp[i];
}
free_results_countpairs_theta(&results);
return Py_BuildValue("(Od)", ret, c_api_time);

PyObject *rettuple = Py_BuildValue("(Od)", ret, c_api_time);
Py_DECREF(ret); // transfer reference ownership to the tuple
return rettuple;
}


Expand Down Expand Up @@ -2248,5 +2257,7 @@ static PyObject *countpairs_countspheres_vpf_mocks(PyObject *self, PyObject *arg
}
free_results_countspheres_mocks(&results);

return Py_BuildValue("(Od)", ret, c_api_time);
PyObject *rettuple = Py_BuildValue("(Od)", ret, c_api_time);
Py_DECREF(ret); // transfer reference ownership to the tuple
return rettuple;
}
27 changes: 21 additions & 6 deletions theory/python_bindings/_countpairs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,10 @@ static PyObject *countpairs_countpairs(PyObject *self, PyObject *args, PyObject
}

free_results(&results);
return Py_BuildValue("(Od)", ret, c_api_time);

PyObject *rettuple = Py_BuildValue("(Od)", ret, c_api_time);
Py_DECREF(ret); // transfer reference ownership to the tuple
return rettuple;
}


Expand Down Expand Up @@ -1722,7 +1725,9 @@ static PyObject *countpairs_countpairs_rp_pi(PyObject *self, PyObject *args, PyO
}
free_results_rp_pi(&results);

return Py_BuildValue("(Od)", ret, c_api_time);
PyObject *rettuple = Py_BuildValue("(Od)", ret, c_api_time);
Py_DECREF(ret); // transfer reference ownership to the tuple
return rettuple;
}

static PyObject *countpairs_countpairs_wp(PyObject *self, PyObject *args, PyObject *kwargs)
Expand Down Expand Up @@ -1963,7 +1968,10 @@ static PyObject *countpairs_countpairs_wp(PyObject *self, PyObject *args, PyObje
}
free_cell_timings(&options);
}
return Py_BuildValue("(OdO)", ret, c_api_time, c_cell_time);
PyObject *rettuple = Py_BuildValue("(OdO)", ret, c_api_time, c_cell_time);
Py_DECREF(ret); // transfer reference ownership to the tuple
Py_DECREF(c_cell_time);
return rettuple;
}


Expand Down Expand Up @@ -2185,7 +2193,9 @@ static PyObject *countpairs_countpairs_xi(PyObject *self, PyObject *args, PyObje
}
free_results_xi(&results);

return Py_BuildValue("(Od)", ret, c_api_time);
PyObject *rettuple = Py_BuildValue("(Od)", ret, c_api_time);
Py_DECREF(ret); // transfer reference ownership to the tuple
return rettuple;
}


Expand Down Expand Up @@ -2489,7 +2499,9 @@ static PyObject *countpairs_countpairs_s_mu(PyObject *self, PyObject *args, PyOb
}
free_results_s_mu(&results);

return Py_BuildValue("(Od)", ret, c_api_time);
PyObject *rettuple = Py_BuildValue("(Od)", ret, c_api_time);
Py_DECREF(ret); // transfer reference ownership to the tuple
return rettuple;
}


Expand Down Expand Up @@ -2661,5 +2673,8 @@ static PyObject *countpairs_countspheres_vpf(PyObject *self, PyObject *args, PyO
}

free_results_countspheres(&results);
return Py_BuildValue("(Od)", ret, c_api_time);

PyObject *rettuple = Py_BuildValue("(Od)", ret, c_api_time);
Py_DECREF(ret); // transfer reference ownership to the tuple
return rettuple;
}