Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-python-gammu for 
openSUSE:Factory checked in at 2022-01-16 23:18:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-python-gammu (Old)
 and      /work/SRC/openSUSE:Factory/.python-python-gammu.new.1892 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-python-gammu"

Sun Jan 16 23:18:18 2022 rev:13 rq:946777 version:3.2.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-python-gammu/python-python-gammu.changes  
2021-08-20 16:58:21.098829977 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-python-gammu.new.1892/python-python-gammu.changes
        2022-01-16 23:19:17.046378044 +0100
@@ -1,0 +2,6 @@
+Sun Jan 16 12:42:11 UTC 2022 - Dirk M??ller <dmuel...@suse.com>
+
+- update to 3.2.4:
+  * python 3.10 support 
+
+-------------------------------------------------------------------

Old:
----
  python-gammu-3.2.3.tar.gz

New:
----
  python-gammu-3.2.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-python-gammu.spec ++++++
--- /var/tmp/diff_new_pack.gi1tEH/_old  2022-01-16 23:19:17.482378259 +0100
+++ /var/tmp/diff_new_pack.gi1tEH/_new  2022-01-16 23:19:17.486378261 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-python-gammu
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define skip_python2 1
 Name:           python-python-gammu
-Version:        3.2.3
+Version:        3.2.4
 Release:        0
 Summary:        Python module to communicate with mobile phones
 License:        GPL-2.0-or-later

++++++ python-gammu-3.2.3.tar.gz -> python-gammu-3.2.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-gammu-3.2.3/.github/workflows/test.yml 
new/python-gammu-3.2.4/.github/workflows/test.yml
--- old/python-gammu-3.2.3/.github/workflows/test.yml   2021-08-17 
21:05:11.000000000 +0200
+++ new/python-gammu-3.2.4/.github/workflows/test.yml   2021-11-17 
08:49:57.000000000 +0100
@@ -8,7 +8,12 @@
     strategy:
       matrix:
         os: [ubuntu-latest, windows-latest]
-        python-version: [3.6, 3.7, 3.8, 3.9]
+        python-version: 
+          - "3.6"
+          - "3.7"
+          - "3.8"
+          - "3.9"
+          - "3.10"
     name: ${{ matrix.os }}, Python ${{ matrix.python-version }}
 
     steps:
@@ -43,6 +48,6 @@
         run: coverage run --source=. ./setup.py test
       - name: Coverage
         run: coverage xml
-      - uses: codecov/codecov-action@v2.0.2
+      - uses: codecov/codecov-action@v2.1.0
         with:
           name: ${{ matrix.os }}, Python ${{ matrix.python-version }}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-gammu-3.2.3/.pre-commit-config.yaml 
new/python-gammu-3.2.4/.pre-commit-config.yaml
--- old/python-gammu-3.2.3/.pre-commit-config.yaml      2021-08-17 
21:05:11.000000000 +0200
+++ new/python-gammu-3.2.4/.pre-commit-config.yaml      2021-11-17 
08:49:57.000000000 +0100
@@ -8,20 +8,20 @@
       - id: check-merge-conflict
       - id: debug-statements
   - repo: https://github.com/pycqa/isort
-    rev: 5.9.3
+    rev: 5.10.1
     hooks:
       - id: isort
   - repo: https://github.com/asottile/pyupgrade
-    rev: v2.23.3
+    rev: v2.29.0
     hooks:
       - id: pyupgrade
         args: [--py36-plus]
   - repo: https://github.com/psf/black
-    rev: 21.7b0
+    rev: 21.10b0
     hooks:
       - id: black
   - repo: https://github.com/asottile/blacken-docs
-    rev: v1.10.0
+    rev: v1.11.0
     hooks:
       - id: blacken-docs
   - repo: meta
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-gammu-3.2.3/NEWS.rst 
new/python-gammu-3.2.4/NEWS.rst
--- old/python-gammu-3.2.3/NEWS.rst     2021-08-17 21:05:11.000000000 +0200
+++ new/python-gammu-3.2.4/NEWS.rst     2021-11-17 08:49:57.000000000 +0100
@@ -1,3 +1,8 @@
+3.2.4
+=====
+
+* Compatibility with Python 3.10.
+
 3.2.3
 =====
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-gammu-3.2.3/admin/release 
new/python-gammu-3.2.4/admin/release
--- old/python-gammu-3.2.3/admin/release        2021-08-17 21:05:11.000000000 
+0200
+++ new/python-gammu-3.2.4/admin/release        2021-11-17 08:49:57.000000000 
+0100
@@ -4,7 +4,7 @@
 set -x
 set -e
 
-VERSION=`sed -n "s/VERSION = '\(.*\)'/\\1/p" setup.py`
+VERSION=`sed -n 's/VERSION = "\(.*\)"/\\1/p' setup.py`
 
 # Create tag 
 git tag -s "$VERSION" -m "Version $VERSION"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-gammu-3.2.3/gammu/src/convertors/base.c 
new/python-gammu-3.2.4/gammu/src/convertors/base.c
--- old/python-gammu-3.2.3/gammu/src/convertors/base.c  2021-08-17 
21:05:11.000000000 +0200
+++ new/python-gammu-3.2.4/gammu/src/convertors/base.c  2021-11-17 
08:49:57.000000000 +0100
@@ -50,38 +50,6 @@
                        else
                                return TRUE;
                }
-#if PY_MAJOR_VERSION < 3
-               if (PyInt_Check(o)) {
-                       i = PyInt_AsLong(o);
-                       if (i == 0)
-                               return FALSE;
-                       else
-                               return TRUE;
-               }
-               if (PyString_Check(o)) {
-                       s = PyString_AsString(o);
-                       if (isdigit((int)s[0])) {
-                               i = atoi(s);
-                               if (i == 0)
-                                       return FALSE;
-                               else
-                                       return TRUE;
-                       } else if (strcasecmp(s, "yes") == 0) {
-                               return TRUE;
-                       } else if (strcasecmp(s, "true") == 0) {
-                               return TRUE;
-                       } else if (strcasecmp(s, "no") == 0) {
-                               return FALSE;
-                       } else if (strcasecmp(s, "false") == 0) {
-                               return FALSE;
-                       } else {
-                               PyErr_Format(PyExc_ValueError,
-                                            "String value of '%s' doesn't seem 
to be boolean",
-                                            key);
-                               return BOOL_INVALID;
-                       }
-               }
-#endif
                if (PyUnicode_Check(o)) {
                        o2 = PyUnicode_AsASCIIString(o);
                        if (o2 == NULL) {
@@ -164,25 +132,6 @@
                return (int)PyLong_AsLongLong(o);
        }
 
-#if PY_MAJOR_VERSION < 3
-       if (PyInt_Check(o)) {
-               return PyInt_AsLong(o);
-       }
-
-       if (PyString_Check(o)) {
-               s = PyString_AsString(o);
-               if (isdigit((int)s[0])) {
-                       i = atoi(s);
-                       return i;
-               } else {
-                       PyErr_Format(PyExc_ValueError,
-                                    "Value of '%s' doesn't seem to be integer",
-                                    key);
-                       return INT_INVALID;
-               }
-       }
-#endif
-
        if (PyUnicode_Check(o)) {
                o2 = PyUnicode_AsASCIIString(o);
                if (o2 == NULL) {
@@ -307,12 +256,6 @@
                }
                ps = PyBytes_AsString(o2);
        }
-#if PY_MAJOR_VERSION < 3
-       else if (PyString_Check(o)) {
-               ps = PyString_AsString(o);
-       }
-#endif
-
 
        if (ps == NULL) {
                PyErr_Format(PyExc_ValueError,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-gammu-3.2.3/gammu/src/convertors/sms.c 
new/python-gammu-3.2.4/gammu/src/convertors/sms.c
--- old/python-gammu-3.2.3/gammu/src/convertors/sms.c   2021-08-17 
21:05:11.000000000 +0200
+++ new/python-gammu-3.2.4/gammu/src/convertors/sms.c   2021-11-17 
08:49:57.000000000 +0100
@@ -21,6 +21,7 @@
 
 /* SMS related conversions */
 
+#define PY_SSIZE_T_CLEAN
 #include "convertors.h"
 #include "misc.h"
 
@@ -683,13 +684,9 @@
                return NULL;
 
        val = Py_BuildValue(
-#if PY_MAJOR_VERSION >= 3
                "{s:s,s:y#,s:i,s:i,s:i,s:i}",
-#else
-               "{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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-gammu-3.2.3/gammu/src/convertors/string.c 
new/python-gammu-3.2.4/gammu/src/convertors/string.c
--- old/python-gammu-3.2.3/gammu/src/convertors/string.c        2021-08-17 
21:05:11.000000000 +0200
+++ new/python-gammu-3.2.4/gammu/src/convertors/string.c        2021-11-17 
08:49:57.000000000 +0100
@@ -26,14 +26,11 @@
 unsigned char *StringPythonToGammu(PyObject * o)
 {
        PyObject *u;
-       Py_UNICODE *ps;
+       wchar_t *ps;
        unsigned char *gs;
+       Py_ssize_t len;
 
-#if PY_MAJOR_VERSION >= 3
        u = PyObject_Str(o);
-#else
-       u = PyObject_Unicode(o);
-#endif
 
        if (u == NULL) {
                PyErr_Format(PyExc_ValueError,
@@ -41,8 +38,16 @@
                return NULL;
        }
 
-       ps = PyUnicode_AsUnicode(u);
+       len = PyUnicode_GET_LENGTH(u) + 1;
+       ps = malloc(len * sizeof(wchar_t));
        if (ps == NULL) {
+               PyErr_SetString(PyExc_MemoryError,
+                               "Not enough memory to allocate string");
+               return NULL;
+       }
+
+       len = PyUnicode_AsWideChar(u, ps, len -1);
+       if (len == -1) {
                PyErr_Format(PyExc_ValueError, "Can not get unicode value");
                return NULL;
        }
@@ -51,10 +56,10 @@
        return gs;
 }
 
-unsigned char *strPythonToGammu(const Py_UNICODE * src, const size_t len)
+unsigned char *strPythonToGammu(const wchar_t * src, const size_t len)
 {
        unsigned char *dest;
-       Py_UNICODE wc, tmp;
+       wchar_t wc, tmp;
        size_t i, j;
 
        /* Allocate memory */
@@ -93,7 +98,7 @@
        return dest;
 }
 
-Py_UNICODE *strGammuToPython(const unsigned char *src)
+wchar_t *strGammuToPython(const unsigned char *src)
 {
        int len = 0;
        size_t out_len = 0;
@@ -104,14 +109,14 @@
        return strGammuToPythonL(src, len, &out_len);
 }
 
-Py_UNICODE *strGammuToPythonL(const unsigned char *src, const int len, size_t 
*out_len)
+wchar_t *strGammuToPythonL(const unsigned char *src, const int len, size_t 
*out_len)
 {
-       Py_UNICODE *dest;
-       Py_UNICODE value, second;
+       wchar_t *dest;
+       wchar_t value, second;
        int i;
 
        /* Allocate memory */
-       dest = malloc((len + 1) * sizeof(Py_UNICODE));
+       dest = malloc((len + 1) * sizeof(wchar_t));
        if (dest == NULL) {
                PyErr_SetString(PyExc_MemoryError,
                                "Not enough memory to allocate string");
@@ -150,14 +155,14 @@
 
 PyObject *UnicodeStringToPythonL(const unsigned char *src, const Py_ssize_t 
len)
 {
-       Py_UNICODE *val;
+       wchar_t *val;
        PyObject *res;
        size_t out_len = 0;
 
        val = strGammuToPythonL(src, len, &out_len);
        if (val == NULL)
                return NULL;
-       res = PyUnicode_FromUnicode(val, out_len);
+       res = PyUnicode_FromWideChar(val, out_len);
        free(val);
        return res;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-gammu-3.2.3/gammu/src/convertors/time.c 
new/python-gammu-3.2.4/gammu/src/convertors/time.c
--- old/python-gammu-3.2.3/gammu/src/convertors/time.c  2021-08-17 
21:05:11.000000000 +0200
+++ new/python-gammu-3.2.4/gammu/src/convertors/time.c  2021-11-17 
08:49:57.000000000 +0100
@@ -23,11 +23,6 @@
 
 #include "convertors.h"
 
-#if PY_MAJOR_VERSION >= 3
-#define PyInt_Check PyLong_Check
-#define PyInt_AsLong PyLong_AsLong
-#endif
-
 PyObject *BuildPythonDateTime(const GSM_DateTime * dt)
 {
        PyObject *pModule;
@@ -89,13 +84,13 @@
                PyErr_Format(PyExc_ValueError, "Attribute year is missing");
                return 0;
        }
-       if (!PyInt_Check(result)) {
+       if (!PyLong_Check(result)) {
                PyErr_Format(PyExc_ValueError,
                             "Attribute %s doesn't seem to be integer", "year");
                Py_DECREF(result);
                return 0;
        }
-       dt->Year = PyInt_AsLong(result);
+       dt->Year = PyLong_AsLong(result);
        Py_DECREF(result);
 
        result = PyObject_GetAttrString(pydt, "month");
@@ -103,14 +98,14 @@
                PyErr_Format(PyExc_ValueError, "Attribute month is missing");
                return 0;
        }
-       if (!PyInt_Check(result)) {
+       if (!PyLong_Check(result)) {
                Py_DECREF(result);
                PyErr_Format(PyExc_ValueError,
                             "Attribute %s doesn't seem to be integer",
                             "month");
                return 0;
        }
-       dt->Month = PyInt_AsLong(result);
+       dt->Month = PyLong_AsLong(result);
        Py_DECREF(result);
 
        result = PyObject_GetAttrString(pydt, "day");
@@ -118,13 +113,13 @@
                PyErr_Format(PyExc_ValueError, "Attribute day is missing");
                return 0;
        }
-       if (!PyInt_Check(result)) {
+       if (!PyLong_Check(result)) {
                Py_DECREF(result);
                PyErr_Format(PyExc_ValueError,
                             "Attribute %s doesn't seem to be integer", "day");
                return 0;
        }
-       dt->Day = PyInt_AsLong(result);
+       dt->Day = PyLong_AsLong(result);
        Py_DECREF(result);
 
        result = PyObject_GetAttrString(pydt, "hour");
@@ -132,13 +127,13 @@
                PyErr_Format(PyExc_ValueError, "Attribute hour is missing");
                return 0;
        }
-       if (!PyInt_Check(result)) {
+       if (!PyLong_Check(result)) {
                Py_DECREF(result);
                PyErr_Format(PyExc_ValueError,
                             "Attribute %s doesn't seem to be integer", "hour");
                return 0;
        }
-       dt->Hour = PyInt_AsLong(result);
+       dt->Hour = PyLong_AsLong(result);
        Py_DECREF(result);
 
        result = PyObject_GetAttrString(pydt, "minute");
@@ -146,14 +141,14 @@
                PyErr_Format(PyExc_ValueError, "Attribute minute is missing");
                return 0;
        }
-       if (!PyInt_Check(result)) {
+       if (!PyLong_Check(result)) {
                Py_DECREF(result);
                PyErr_Format(PyExc_ValueError,
                             "Attribute %s doesn't seem to be integer",
                             "minute");
                return 0;
        }
-       dt->Minute = PyInt_AsLong(result);
+       dt->Minute = PyLong_AsLong(result);
        Py_DECREF(result);
 
        result = PyObject_GetAttrString(pydt, "second");
@@ -161,14 +156,14 @@
                PyErr_Format(PyExc_ValueError, "Attribute second is missing");
                return 0;
        }
-       if (!PyInt_Check(result)) {
+       if (!PyLong_Check(result)) {
                Py_DECREF(result);
                PyErr_Format(PyExc_ValueError,
                             "Attribute %s doesn't seem to be integer",
                             "second");
                return 0;
        }
-       dt->Second = PyInt_AsLong(result);
+       dt->Second = PyLong_AsLong(result);
        Py_DECREF(result);
 
        return 1;
@@ -186,33 +181,33 @@
        result = PyObject_GetAttrString(pydt, "year");
        if (result == NULL)
                return 0;
-       if (!PyInt_Check(result)) {
+       if (!PyLong_Check(result)) {
                PyErr_Format(PyExc_ValueError,
                             "Attribute %s doesn't seem to be integer", "year");
                return 0;
        }
-       dt->Year = PyInt_AsLong(result);
+       dt->Year = PyLong_AsLong(result);
 
        result = PyObject_GetAttrString(pydt, "month");
        if (result == NULL)
                return 0;
-       if (!PyInt_Check(result)) {
+       if (!PyLong_Check(result)) {
                PyErr_Format(PyExc_ValueError,
                             "Attribute %s doesn't seem to be integer",
                             "month");
                return 0;
        }
-       dt->Month = PyInt_AsLong(result);
+       dt->Month = PyLong_AsLong(result);
 
        result = PyObject_GetAttrString(pydt, "day");
        if (result == NULL)
                return 0;
-       if (!PyInt_Check(result)) {
+       if (!PyLong_Check(result)) {
                PyErr_Format(PyExc_ValueError,
                             "Attribute %s doesn't seem to be integer", "day");
                return 0;
        }
-       dt->Day = PyInt_AsLong(result);
+       dt->Day = PyLong_AsLong(result);
        return 1;
 }
 
@@ -228,34 +223,34 @@
        result = PyObject_GetAttrString(pydt, "hour");
        if (result == NULL)
                return 0;
-       if (!PyInt_Check(result)) {
+       if (!PyLong_Check(result)) {
                PyErr_Format(PyExc_ValueError,
                             "Attribute %s doesn't seem to be integer", "hour");
                return 0;
        }
-       dt->Hour = PyInt_AsLong(result);
+       dt->Hour = PyLong_AsLong(result);
 
        result = PyObject_GetAttrString(pydt, "minute");
        if (result == NULL)
                return 0;
-       if (!PyInt_Check(result)) {
+       if (!PyLong_Check(result)) {
                PyErr_Format(PyExc_ValueError,
                             "Attribute %s doesn't seem to be integer",
                             "minute");
                return 0;
        }
-       dt->Minute = PyInt_AsLong(result);
+       dt->Minute = PyLong_AsLong(result);
 
        result = PyObject_GetAttrString(pydt, "second");
        if (result == NULL)
                return 0;
-       if (!PyInt_Check(result)) {
+       if (!PyLong_Check(result)) {
                PyErr_Format(PyExc_ValueError,
                             "Attribute %s doesn't seem to be integer",
                             "second");
                return 0;
        }
-       dt->Second = PyInt_AsLong(result);
+       dt->Second = PyLong_AsLong(result);
 
        return 1;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-gammu-3.2.3/gammu/src/gammu.c 
new/python-gammu-3.2.4/gammu/src/gammu.c
--- old/python-gammu-3.2.3/gammu/src/gammu.c    2021-08-17 21:05:11.000000000 
+0200
+++ new/python-gammu-3.2.4/gammu/src/gammu.c    2021-11-17 08:49:57.000000000 
+0100
@@ -18,6 +18,7 @@
  *
  */
 
+#define PY_SSIZE_T_CLEAN
 /* Python-gammu configuration */
 #include <Python.h>
 #include <bytesobject.h>
@@ -116,18 +117,16 @@
     GSM_Error           error;
     PyObject            *new_debug_object = NULL;
     PyObject            *str;
-#if PY_MAJOR_VERSION >= 3
     int                 fd;
 
     fd = PyObject_AsFileDescriptor(value);
     if (fd == -1) {
         PyErr_Clear();
     }
-#endif
+
     if (value == Py_None) {
         error = GSM_SetDebugFileDescriptor(NULL, FALSE, di);
         if (!checkError(error, "SetDebugFileDescriptor")) return NULL;
-#if PY_MAJOR_VERSION >= 3
     } else if (fd != -1) {
         new_debug_object = value;
         fd = dup(fd);
@@ -137,20 +136,8 @@
 
         error = GSM_SetDebugFileDescriptor(f, TRUE, di);
         if (!checkError(error, "SetDebugFileDescriptor")) return NULL;
-#else
-    } else if (PyFile_Check(value)) {
-        f = PyFile_AsFile(value);
-        if (f == NULL) return NULL;
-        new_debug_object = value;
-        error = GSM_SetDebugFileDescriptor(f, FALSE, di);
-        if (!checkError(error, "SetDebugFileDescriptor")) return NULL;
-#endif
     } else if (PyUnicode_Check(value)) {
-#if PY_MAJOR_VERSION >= 3
         str = PyUnicode_EncodeFSDefault(value);
-#else
-        str = PyUnicode_AsUTF8String(value);
-#endif
         if (str == NULL) {
             return NULL;
         }
@@ -159,13 +146,6 @@
         error = GSM_SetDebugFile(s, di);
         Py_DECREF(str);
         if (!checkError(error, "SetDebugFile")) return NULL;
-#if PY_MAJOR_VERSION < 3
-    } else if (PyString_Check(value)) {
-        s = PyString_AsString(value);
-        if (s == NULL) return NULL;
-        error = GSM_SetDebugFile(s, di);
-        if (!checkError(error, "SetDebugFile")) return NULL;
-#endif
     } else {
         PyErr_SetString(PyExc_TypeError, "Valid are only None, string or file 
parameters!");
         return NULL;
@@ -592,10 +572,6 @@
                 return NULL;
             }
             s = PyBytes_AsString(keystr);
-#if PY_MAJOR_VERSION < 3
-        } else {
-            s = PyString_AsString(key);
-#endif
         }
 
         if (s == NULL) {
@@ -625,11 +601,7 @@
         } else {
             if (PyBytes_Check(value) || PyUnicode_Check(value)) {
                 if (PyUnicode_Check(value)) {
-#if PY_MAJOR_VERSION >= 3
                     str = PyUnicode_EncodeFSDefault(value);
-#else
-                    str = PyUnicode_AsUTF8String(value);
-#endif
                     if (str == NULL) {
                         PyErr_Format(PyExc_ValueError, "Non string value for 
%s (unicode)", s);
                         return NULL;
@@ -3520,7 +3492,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;
 
@@ -5529,12 +5501,7 @@
 ;
 
 static PyTypeObject StateMachineType = {
-#if PY_MAJOR_VERSION >= 3
     PyVarObject_HEAD_INIT(NULL, 0)
-#else
-    PyObject_HEAD_INIT(NULL)
-    0,                         /*ob_size*/
-#endif
     "_gammu.StateMachine",                     /*tp_name*/
     sizeof(StateMachineObject),                /*tp_basicsize*/
     0,                         /*tp_itemsize*/
@@ -6085,9 +6052,7 @@
     GSM_Ringtone                ringtone;
     gboolean                    closefile = FALSE;
     PyObject                    *str;
-#if PY_MAJOR_VERSION >= 3
     int                 fd;
-#endif
 
     if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO!s", kwlist,
                 &file, &PyDict_Type, &(value), &s))
@@ -6097,7 +6062,6 @@
         return NULL;
     }
 
-#if PY_MAJOR_VERSION >= 3
     fd = PyObject_AsFileDescriptor(value);
     if (fd == -1) {
         PyErr_Clear();
@@ -6109,17 +6073,8 @@
         f = fdopen(fd, "wb");
         if (f == NULL) return NULL;
         closefile = TRUE;
-#else
-    if (PyFile_Check(file)) {
-        f = PyFile_AsFile(file);
-        if (f == NULL) return NULL;
-#endif
     } else if (PyUnicode_Check(value)) {
-#if PY_MAJOR_VERSION >= 3
         str = PyUnicode_EncodeFSDefault(value);
-#else
-        str = PyUnicode_AsUTF8String(value);
-#endif
         if (str == NULL) {
             return NULL;
         }
@@ -6132,17 +6087,6 @@
             return NULL;
         }
         closefile = TRUE;
-#if PY_MAJOR_VERSION < 3
-    } else if (PyString_Check(file)) {
-        name = PyString_AsString(file);
-        if (name == NULL) return NULL;
-        f = fopen(name, "wb");
-        if (f == NULL) {
-            PyErr_SetString(PyExc_IOError, "Can not open file for writing!");
-            return NULL;
-        }
-        closefile = TRUE;
-#endif
     } else {
         PyErr_SetString(PyExc_TypeError, "Valid are only string or file 
parameters!");
         return NULL;
@@ -6410,7 +6354,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;
 
@@ -6584,8 +6528,6 @@
 ;
 
 
-#if PY_MAJOR_VERSION >= 3
-
 static struct PyModuleDef moduledef = {
         PyModuleDef_HEAD_INIT,
         "gammu",
@@ -6598,55 +6540,42 @@
         NULL
 };
 
-#define INITERROR return NULL
-
 PyObject *
 PyInit__gammu(void)
-
-#else
-#define INITERROR return
-
-void
-init_gammu(void)
-#endif
 {
     PyObject *module, *d;
     GSM_Debug_Info *di;
 
     /* Create the module and add the functions */
-#if PY_MAJOR_VERSION >= 3
     module = PyModule_Create(&moduledef);
-#else
-    module = Py_InitModule3("_gammu", gammu_methods, 
gammu_module_documentation);
-#endif
 
     if (module == NULL)
-        INITERROR;
+        return NULL;
 
     DebugFile = NULL;
 
     d = PyModule_GetDict(module);
 
     if (PyType_Ready(&StateMachineType) < 0)
-        INITERROR;
+        return NULL;
     Py_INCREF(&StateMachineType);
 
     if (PyModule_AddObject(module, "StateMachine", (PyObject 
*)&StateMachineType) < 0)
-        INITERROR;
+        return NULL;
 
     /* SMSD object */
     if (!gammu_smsd_init(module))
-        INITERROR;
+        return NULL;
 
     /* Add some symbolic constants to the module */
 
     /* Define errors */
     if (!gammu_create_errors(d))
-        INITERROR;
+        return NULL;
 
     /* Define data */
     if (!gammu_create_data(d))
-        INITERROR;
+        return NULL;
 
     /* Check for errors */
     if (PyErr_Occurred()) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-gammu-3.2.3/gammu/src/smsd.c 
new/python-gammu-3.2.4/gammu/src/smsd.c
--- old/python-gammu-3.2.3/gammu/src/smsd.c     2021-08-17 21:05:11.000000000 
+0200
+++ new/python-gammu-3.2.4/gammu/src/smsd.c     2021-11-17 08:49:57.000000000 
+0100
@@ -21,6 +21,8 @@
 
 /* Python-gammu configuration */
 
+#define PY_SSIZE_T_CLEAN
+
 /* Python includes */
 #include <Python.h>
 
@@ -235,12 +237,7 @@
 static char SMSDType__doc__[] = "SMSD object, that is used for communication 
with phone.";
 
 static PyTypeObject SMSDType = {
-#if PY_MAJOR_VERSION >= 3
-    PyVarObject_HEAD_INIT(NULL, 0)
-#else
-       PyObject_HEAD_INIT(NULL)
-       0,                      /*ob_size */
-#endif
+       PyVarObject_HEAD_INIT(NULL, 0)
        "_gammu.SMSD",          /*tp_name */
        sizeof(SMSDObject),     /*tp_basicsize */
        0,                      /*tp_itemsize */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-gammu-3.2.3/gammu/worker.py 
new/python-gammu-3.2.4/gammu/worker.py
--- old/python-gammu-3.2.3/gammu/worker.py      2021-08-17 21:05:11.000000000 
+0200
+++ new/python-gammu-3.2.4/gammu/worker.py      2021-11-17 08:49:57.000000000 
+0100
@@ -43,7 +43,7 @@
         @param value: Name of wrong command.
         @type value: string
         """
-        Exception.__init__(self)
+        super().__init__()
         self.value = value
 
     def __str__(self):
@@ -181,7 +181,7 @@
         thread, so please take care of various threading issues in other
         modules you use.
         """
-        threading.Thread.__init__(self)
+        super().__init__()
         self._kill = False
         self._terminate = False
         self._sm = gammu.StateMachine()
@@ -259,7 +259,7 @@
         Terminates thread and waits for it.
         """
         self._terminate = True
-        threading.Thread.join(self, timeout)
+        super().join(timeout)
 
 
 class GammuWorker:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-gammu-3.2.3/setup.py 
new/python-gammu-3.2.4/setup.py
--- old/python-gammu-3.2.3/setup.py     2021-08-17 21:05:11.000000000 +0200
+++ new/python-gammu-3.2.4/setup.py     2021-11-17 08:49:57.000000000 +0100
@@ -35,7 +35,7 @@
 from setuptools import Extension, setup
 
 # some defines
-VERSION = "3.2.3"
+VERSION = "3.2.4"
 GAMMU_REQUIRED = "1.37.90"
 
 # readme

Reply via email to