From: Boyuan Yang <byang@debian.org>
Date: Wed, 4 Jan 2023 10:47:58 -0500
Subject: python: enum: fix build for Python 3.11

Forwarded: https://github.com/mchehab/zbar/pull/231
---
 python/enum.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/python/enum.c b/python/enum.c
index dfe1b1e..4833a20 100644
--- a/python/enum.c
+++ b/python/enum.c
@@ -52,7 +52,11 @@ enumitem_new (PyTypeObject *type,
 
     /* 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
@@ -143,7 +147,11 @@ zbarEnumItem_New (PyObject *byname,
 
     /* 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);
 
