Skip to content

Commit

Permalink
Fix building with Python 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
artfwo committed Nov 4, 2024
1 parent 0bddd3b commit 532622f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/aalink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,11 @@ struct Link {
void set_num_peers_callback(py::function callback) {
m_link.setNumPeersCallback([this, callback](std::size_t num_peers) {
// ensure the callback isn't called when the runtime is finalizing
#if PY_VERSION_HEX < 0x30d0000
if (!_Py_IsFinalizing()) {
#else
if (!Py_IsFinalizing()) {
#endif
py::gil_scoped_acquire acquire;

auto loop_call_soon_threadsafe = this->m_loop.attr("call_soon_threadsafe");
Expand All @@ -269,7 +273,11 @@ struct Link {
void set_tempo_callback(py::function callback) {
m_link.setTempoCallback([this, callback](double tempo) {
// ensure the callback isn't called when the runtime is finalizing
#if PY_VERSION_HEX < 0x30d0000
if (!_Py_IsFinalizing()) {
#else
if (!Py_IsFinalizing()) {
#endif
py::gil_scoped_acquire acquire;

auto loop_call_soon_threadsafe = this->m_loop.attr("call_soon_threadsafe");
Expand All @@ -281,7 +289,11 @@ struct Link {
void set_start_stop_callback(py::function callback) {
m_link.setStartStopCallback([this, callback](bool playing) {
// ensure the callback isn't called when the runtime is finalizing
#if PY_VERSION_HEX < 0x30d0000
if (!_Py_IsFinalizing()) {
#else
if (!Py_IsFinalizing()) {
#endif
py::gil_scoped_acquire acquire;

auto loop_call_soon_threadsafe = this->m_loop.attr("call_soon_threadsafe");
Expand Down

0 comments on commit 532622f

Please sign in to comment.