]>
Commit | Line | Data |
---|---|---|
fd954e21 JP |
1 | From 80a36beca0adf30abff1807ec6436ca16ee9d4de Mon Sep 17 00:00:00 2001 |
2 | From: Graham Inggs <ginggs@debian.org> | |
3 | Date: Thu, 20 Jan 2022 09:29:37 +0200 | |
4 | Subject: [PATCH] Make code compatible with Python 3.10 As noted in bpo-30459, | |
5 | PyTuple_SET_ITEM() does not return a value. | |
6 | ||
7 | https://bugs.python.org/issue30459 | |
8 | --- | |
9 | modules/mixer/simple/python.c | 20 ++++++++++---------- | |
10 | 1 file changed, 10 insertions(+), 10 deletions(-) | |
11 | ||
12 | diff --git a/modules/mixer/simple/python.c b/modules/mixer/simple/python.c | |
13 | index 8a7264d4..6b51e6bc 100644 | |
14 | --- a/modules/mixer/simple/python.c | |
15 | +++ b/modules/mixer/simple/python.c | |
16 | @@ -775,8 +775,8 @@ pymixer_melement_new(struct pymixer *pymixer, PyObject *args) | |
17 | obj = PyDict_GetItemString(pymixer->mdict, class); | |
18 | if (obj) { | |
19 | obj1 = PyTuple_New(4); | |
20 | - if (PyTuple_SET_ITEM(obj1, 0, (PyObject *)pymixer)) | |
21 | - Py_INCREF((PyObject *)pymixer); | |
22 | + PyTuple_SET_ITEM(obj1, 0, (PyObject *)pymixer); | |
23 | + Py_INCREF((PyObject *)pymixer); | |
24 | PyTuple_SET_ITEM(obj1, 1, PyUnicode_FromString(name)); | |
25 | PyTuple_SET_ITEM(obj1, 2, PyInt_FromLong(index)); | |
26 | PyTuple_SET_ITEM(obj1, 3, PyInt_FromLong(weight)); | |
27 | @@ -920,8 +920,8 @@ static PyObject *new_helem(struct python_priv *priv, snd_hctl_elem_t *helem) | |
28 | obj = PyDict_GetItemString(priv->py_mdict, "HElement"); | |
29 | if (obj) { | |
30 | obj1 = PyTuple_New(3); | |
31 | - if (PyTuple_SET_ITEM(obj1, 0, py_hctl)) | |
32 | - Py_INCREF(py_hctl); | |
33 | + PyTuple_SET_ITEM(obj1, 0, py_hctl); | |
34 | + Py_INCREF(py_hctl); | |
35 | PyTuple_SET_ITEM(obj1, 1, PyFloat_FromDouble(1)); | |
36 | PyTuple_SET_ITEM(obj1, 2, PyInt_FromLong((long)helem)); | |
37 | obj2 = PyObject_CallObject(obj, obj1); | |
38 | @@ -995,11 +995,11 @@ int alsa_mixer_simple_event(snd_mixer_class_t *class, unsigned int mask, | |
39 | } | |
40 | if (o == NULL) | |
41 | return 0; | |
42 | - if (PyTuple_SET_ITEM(t, 1, o)) | |
43 | - Py_INCREF(o); | |
44 | + PyTuple_SET_ITEM(t, 1, o); | |
45 | + Py_INCREF(o); | |
46 | o = melem ? find_melem(priv, melem) : Py_None; | |
47 | - if (PyTuple_SET_ITEM(t, 2, o)) | |
48 | - Py_INCREF(o); | |
49 | + PyTuple_SET_ITEM(t, 2, o); | |
50 | + Py_INCREF(o); | |
51 | r = PyObject_CallObject(priv->py_event_func, t); | |
52 | Py_DECREF(t); | |
53 | if (r) { | |
54 | @@ -1066,8 +1066,8 @@ static int alsa_mixer_simple_pyinit(struct python_priv *priv, | |
55 | obj1 = PyTuple_New(3); | |
56 | PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong((long)class)); | |
57 | PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong((long)mixer)); | |
58 | - if (PyTuple_SET_ITEM(obj1, 2, mdict)) | |
59 | - Py_INCREF(mdict); | |
60 | + PyTuple_SET_ITEM(obj1, 2, mdict); | |
61 | + Py_INCREF(mdict); | |
62 | obj2 = PyObject_CallObject(obj, obj1); | |
63 | Py_XDECREF(obj1); | |
64 | PyDict_SetItemString(mdict, "mixer", obj2); |