Package: python-gammu
Version: 2.12-2
Followup-For: Bug #999374
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu jammy ubuntu-patch
Control: tags -1 patch

Hi Michal,

Attached is a patch that fixes this build failure with python 3.10.

Cheers,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru python-gammu-2.12/debian/patches/python-3.10.patch 
python-gammu-2.12/debian/patches/python-3.10.patch
--- python-gammu-2.12/debian/patches/python-3.10.patch  1969-12-31 
16:00:00.000000000 -0800
+++ python-gammu-2.12/debian/patches/python-3.10.patch  2021-11-16 
17:56:32.000000000 -0800
@@ -0,0 +1,70 @@
+Description: fix compatibility with python 3.10
+ Python 3.10 requires use of Py_ssize_t instead of int.
+Author: Steve Langasek <steve.langa...@ubuntu.com>
+Last-Update: 2021-11-16
+Bug-Debian: https://bugs.debian.org/999374
+
+Index: python-gammu-2.12/gammu/src/gammu.c
+===================================================================
+--- python-gammu-2.12.orig/gammu/src/gammu.c
++++ python-gammu-2.12/gammu/src/gammu.c
+@@ -18,6 +18,7 @@
+  *
+  */
+ 
++#define PY_SSIZE_T_CLEAN
+ /* Python-gammu configuration */
+ #include <Python.h>
+ #include <bytesobject.h>
+@@ -3519,7 +3520,7 @@
+     GSM_CallDivert divert;
+     static char         *kwlist[] = {"Divert", "Type", "Number", "Timeout", 
NULL};
+     char                *cond, *type, *number;
+-    int number_len;
++    Py_ssize_t number_len;
+ 
+     divert.Timeout = 0;
+ 
+@@ -6409,7 +6410,7 @@
+     PyObject *o = Py_None;
+     gboolean smsc;
+     const unsigned char *pdu;
+-    int pdulen;
++    Py_ssize_t pdulen;
+       size_t parse_len = 0;
+     GSM_SMSMessage sms;
+ 
+Index: python-gammu-2.12/gammu/src/smsd.c
+===================================================================
+--- python-gammu-2.12.orig/gammu/src/smsd.c
++++ python-gammu-2.12/gammu/src/smsd.c
+@@ -21,6 +21,8 @@
+ 
+ /* Python-gammu configuration */
+ 
++#define PY_SSIZE_T_CLEAN
++
+ /* Python includes */
+ #include <Python.h>
+ 
+Index: python-gammu-2.12/gammu/src/convertors/sms.c
+===================================================================
+--- python-gammu-2.12.orig/gammu/src/convertors/sms.c
++++ python-gammu-2.12/gammu/src/convertors/sms.c
+@@ -21,6 +21,7 @@
+ 
+ /* SMS related conversions */
+ 
++#define PY_SSIZE_T_CLEAN
+ #include "convertors.h"
+ #include "misc.h"
+ 
+@@ -689,7 +690,7 @@
+               "{s:s,s:s#,s:i,s:i,s:i,s:i}",
+ #endif
+               "Type", type,
+-              "Text", udh->Text, udh->Length,
++              "Text", udh->Text, (Py_ssize_t)udh->Length,
+               "ID8bit", udh->ID8bit,
+               "ID16bit", udh->ID16bit,
+               "PartNumber", udh->PartNumber,
diff -Nru python-gammu-2.12/debian/patches/series 
python-gammu-2.12/debian/patches/series
--- python-gammu-2.12/debian/patches/series     1969-12-31 16:00:00.000000000 
-0800
+++ python-gammu-2.12/debian/patches/series     2021-11-16 17:53:10.000000000 
-0800
@@ -0,0 +1 @@
+python-3.10.patch

Reply via email to