Skip to content

Commit

Permalink
Bug tojson memleak (#45489)
Browse files Browse the repository at this point in the history
  • Loading branch information
vernetya authored Jan 22, 2022
1 parent a550e20 commit 8456833
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v1.4.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,7 @@ I/O
- Bug in :func:`read_json` raising ``ValueError`` when attempting to parse json strings containing "://" (:issue:`36271`)
- Bug in :func:`read_csv` when ``engine="c"`` and ``encoding_errors=None`` which caused a segfault (:issue:`45180`)
- Bug in :func:`read_csv` an invalid value of ``usecols`` leading to an unclosed file handle (:issue:`45384`)
- Bug in :meth:`DataFrame.to_json` fix memory leak (:issue:`43877`)

Period
^^^^^^
Expand Down
1 change: 1 addition & 0 deletions pandas/_libs/src/ujson/python/objToJSON.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ static PyObject *get_values(PyObject *obj) {
PyErr_Clear();
} else if (PyObject_HasAttrString(values, "__array__")) {
// We may have gotten a Categorical or Sparse array so call np.array
Py_DECREF(values);
values = PyObject_CallMethod(values, "__array__", NULL);
} else if (!PyArray_CheckExact(values)) {
// Didn't get a numpy array, so keep trying
Expand Down

0 comments on commit 8456833

Please sign in to comment.