Skip to content

Commit

Permalink
Fix reference leaks in error callbacks.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeroIntensity committed Aug 3, 2024
1 parent dfb0a3b commit a4de7b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- Fix coroutine iterator reference leak.
- Fix early exit of `pyawaitable_unpack_arb` if a `NULL` value was saved.
- Fixed coroutine iterator reference leak.
- Fixed reference leak in error callbacks.
- Fixed early exit of `pyawaitable_unpack_arb` if a `NULL` value was saved.
- Added integer value saving and unpacking (`pyawaitable_save_int` and `pyawaitable_unpack_int`).

## [1.0.0] - 2024-06-24
Expand Down
3 changes: 3 additions & 0 deletions src/_pyawaitable/genwrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ genwrapper_new(PyAwaitableObject *aw)
return (PyObject *) g;
}

// Steals references to `cb->coro` and `await`
int
genwrapper_fire_err_callback(
PyObject *self,
Expand Down Expand Up @@ -89,6 +90,8 @@ genwrapper_fire_err_callback(
return -1;
}

Py_DECREF(cb->coro);
Py_XDECREF(await);
Py_DECREF(err);
return 0;
}
Expand Down

0 comments on commit a4de7b7

Please sign in to comment.