[Python-modules-commits] [python-gammu] 01/04: Imported Upstream version 2.4
Michal Cihar
nijel at moszumanska.debian.org
Wed Sep 2 08:39:15 UTC 2015
This is an automated email from the git hooks/post-receive script.
nijel pushed a commit to annotated tag debian/2.4-1
in repository python-gammu.
commit 012c9ad4d5c84921925b0fb9ca7ab5caa5d9f805
Author: Michal Čihař <michal at cihar.com>
Date: Wed Sep 2 10:23:38 2015 +0200
Imported Upstream version 2.4
---
NEWS.rst | 6 ++++++
PKG-INFO | 2 +-
gammu/src/gammu.c | 34 +++++++++++++++++-----------------
gammu/src/smsd.c | 6 +++---
python_gammu.egg-info/PKG-INFO | 2 +-
setup.py | 6 ++++--
test/test_config.py | 3 +++
test/test_smsd.py | 3 +++
8 files changed, 38 insertions(+), 24 deletions(-)
diff --git a/NEWS.rst b/NEWS.rst
index 3356917..777d8f0 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -1,3 +1,9 @@
+2.4
+===
+
+* Fixed possible crash when initializing SMSD with invalid parameters.
+* Fixed crash on handling diverts on certain architectures.
+
2.3
===
diff --git a/PKG-INFO b/PKG-INFO
index 82df1e4..b6241e7 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: python-gammu
-Version: 2.3
+Version: 2.4
Summary: Gammu bindings
Home-page: http://wammu.eu/python-gammu/
Author: Michal Čihař
diff --git a/gammu/src/gammu.c b/gammu/src/gammu.c
index e1301b2..d872743 100644
--- a/gammu/src/gammu.c
+++ b/gammu/src/gammu.c
@@ -3461,7 +3461,7 @@ StateMachine_SetCallDivert(StateMachineObject *self, PyObject *args, PyObject *k
GSM_CallDivert divert;
static char *kwlist[] = {"Divert", "Type", "Number", "Timeout", NULL};
char *cond, *type, *number;
- size_t number_len;
+ int number_len;
divert.Timeout = 0;
@@ -5422,6 +5422,20 @@ StateMachine_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
self = (StateMachineObject *)type->tp_alloc(type, 0);
self->s = GSM_AllocStateMachine();
+ /* Reset our structures */
+ self->DebugFile = NULL;
+ self->IncomingCallback = NULL;
+
+ self->IncomingCallQueue[0] = NULL;
+ self->IncomingSMSQueue[0] = NULL;
+ self->IncomingCBQueue[0] = NULL;
+ self->IncomingUSSDQueue[0] = NULL;
+
+ /* Create phone communication lock */
+#ifdef WITH_THREAD
+ self->mutex = PyThread_allocate_lock();
+#endif
+
return (PyObject *)self;
}
@@ -5432,30 +5446,16 @@ StateMachine_init(StateMachineObject *self, PyObject *args, PyObject *kwds)
static char *kwlist[] = {"Locale", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|s", kwlist, &s))
- return 0;
+ return -1;
if (s != NULL && strcmp(s, "auto") == 0) {
s = NULL;
}
- /* Reset our structures */
- self->DebugFile = NULL;
- self->IncomingCallback = NULL;
-
- self->IncomingCallQueue[0] = NULL;
- self->IncomingSMSQueue[0] = NULL;
- self->IncomingCBQueue[0] = NULL;
- self->IncomingUSSDQueue[0] = NULL;
-
- /* Create phone communication lock */
-#ifdef WITH_THREAD
- self->mutex = PyThread_allocate_lock();
-#endif
-
/* Init Gammu locales, we don't care about NULL, it's handled correctly */
GSM_InitLocales(s);
- return 1;
+ return 0;
}
static char StateMachineType__doc__[] =
diff --git a/gammu/src/smsd.c b/gammu/src/smsd.c
index 2bea9db..463701d 100644
--- a/gammu/src/smsd.c
+++ b/gammu/src/smsd.c
@@ -223,13 +223,13 @@ static int SMSD_init(SMSDObject * self, PyObject * args, PyObject * kwds)
GSM_Error error;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", kwlist, &s))
- return 0;
+ return -1;
error = SMSD_ReadConfig(s, self->config, TRUE);
if (!checkError(error, "SMSD_ReadConfig"))
- return 0;
+ return -1;
- return 1;
+ return 0;
}
static char SMSDType__doc__[] = "SMSD object, that is used for communication with phone.";
diff --git a/python_gammu.egg-info/PKG-INFO b/python_gammu.egg-info/PKG-INFO
index 82df1e4..b6241e7 100644
--- a/python_gammu.egg-info/PKG-INFO
+++ b/python_gammu.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: python-gammu
-Version: 2.3
+Version: 2.4
Summary: Gammu bindings
Home-page: http://wammu.eu/python-gammu/
Author: Michal Čihař
diff --git a/setup.py b/setup.py
index a02dcaf..bba7e05 100755
--- a/setup.py
+++ b/setup.py
@@ -27,11 +27,13 @@ python-gammu - Phone communication libary
import distutils.spawn
from setuptools import setup, Extension
import os
+import codecs
# some defines
-VERSION = '2.3'
+VERSION = '2.4'
GAMMU_REQUIRED = '1.34.0'
-with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
+README_FILE = os.path.join(os.path.dirname(__file__), 'README.rst')
+with codecs.open(README_FILE, 'r', 'utf-8') as readme:
README = readme.read()
diff --git a/test/test_config.py b/test/test_config.py
index b42460c..977be65 100644
--- a/test/test_config.py
+++ b/test/test_config.py
@@ -83,6 +83,9 @@ class ConfigTest(unittest.TestCase):
cfg = state_machine.GetConfig(0)
self.assertEqual(cfg['StartInfo'], 0)
+ def test_init_error(self):
+ self.assertRaises(TypeError, gammu.StateMachine, Bar=1)
+
class DebugTest(unittest.TestCase):
def setUp(self):
diff --git a/test/test_smsd.py b/test/test_smsd.py
index 7ba521f..292d9a1 100644
--- a/test/test_smsd.py
+++ b/test/test_smsd.py
@@ -52,6 +52,9 @@ class SMSDDummyTest(DummyTest):
def get_smsd(self):
return gammu.smsd.SMSD(self.config_name)
+ def test_init_error(self):
+ self.assertRaises(TypeError, gammu.smsd.SMSD, Bar=1)
+
def test_inject(self):
smsd = self.get_smsd()
smsd.InjectSMS([MESSAGE_1])
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-gammu.git
More information about the Python-modules-commits
mailing list