summarylogtreecommitdiffstats
path: root/python313-compile-fix.patch
blob: 56c5003f2e76cf28bcabf7a92a123a1e4a3b16e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From fd88812696f455aef4d1e21da99610534c73c921 Mon Sep 17 00:00:00 2001
From: Echo J <tcg96nougat@gmail.com>
Date: Thu, 26 Dec 2024 10:35:10 +0200
Subject: [PATCH] Remove PyEval_InitThreads() call on Python >=3.7

This function has been removed in Python 3.13 (and has been deprecated
since Python 3.9)
---
 c_src/simpleaudio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/c_src/simpleaudio.c b/c_src/simpleaudio.c
index b0b24b8..b9edeee 100644
--- a/c_src/simpleaudio.c
+++ b/c_src/simpleaudio.c
@@ -158,10 +158,12 @@ static PyObject* _play_buffer(PyObject *self, PyObject *args)
     }
     num_samples = buffer_obj.len / bytes_per_channel / num_channels;
 
+#if PY_VERSION_HEX < 0x03070000
     /* explicitly tell Python we're using threading since the
        it requires a cross-thread API call to release the buffer
        view when we're done playing audio */
     PyEval_InitThreads();
+#endif
 
     /* fixed 100ms latency */
     return play_os(buffer_obj, num_samples, num_channels, bytes_per_channel, sample_rate, &play_list_head, SA_LATENCY_US);
-- 
2.47.1