blob: a51193af777797d0b25fcdb577600ff0c07e1afb (
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
|
Upstream-PR: https://github.com/mchehab/zbar/pull/231
diff --git a/python/enum.c b/python/enum.c
index ba22ba63..4644509e 100644
--- a/python/enum.c
+++ b/python/enum.c
@@ -50,7 +50,11 @@ static zbarEnumItem *enumitem_new(PyTypeObject *type, PyObject *args,
/* we assume the "fast path" for a single-digit ints (see longobject.c) */
/* this also holds if we get a small_int preallocated long */
+#if PY_VERSION_HEX >= 0x030900A4
+ Py_SET_SIZE(&self->val, Py_SIZE(longval));
+#else
Py_SIZE(&self->val) = Py_SIZE(longval);
+#endif
self->val.ob_digit[0] = longval->ob_digit[0];
Py_DECREF(longval);
#else
@@ -129,7 +133,11 @@ zbarEnumItem *zbarEnumItem_New(PyObject *byname, PyObject *byvalue, int val,
/* we assume the "fast path" for a single-digit ints (see longobject.c) */
/* this also holds if we get a small_int preallocated long */
+#if PY_VERSION_HEX >= 0x030900A4
+ Py_SET_SIZE(&self->val, Py_SIZE(longval));
+#else
Py_SIZE(&self->val) = Py_SIZE(longval);
+#endif
self->val.ob_digit[0] = longval->ob_digit[0];
Py_DECREF(longval);
|