[segyio] 52/376: Zero-Initialise Pybuffer

Jørgen Kvalsvik jokva-guest at moszumanska.debian.org
Wed Sep 20 08:04:06 UTC 2017


This is an automated email from the git hooks/post-receive script.

jokva-guest pushed a commit to branch debian
in repository segyio.

commit 60727aef6add76c6fc6ec444721f2fab94401f23
Author: Jørgen Kvalsvik <jokva at statoil.com>
Date:   Wed Oct 19 11:17:00 2016 +0200

    Zero-Initialise Pybuffer
    
    Returning this uninitialised pybuffer object made the windows runs fail
    from python error not being set properly.
---
 python/segyio/_segyio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/python/segyio/_segyio.c b/python/segyio/_segyio.c
index 4206ecc..ed8d3ee 100644
--- a/python/segyio/_segyio.c
+++ b/python/segyio/_segyio.c
@@ -579,7 +579,8 @@ static PyObject *py_init_metrics(PyObject *self, PyObject *args) {
 }
 
 static Py_buffer check_and_get_buffer(PyObject *object, const char *name, unsigned int expected) {
-    Py_buffer buffer;
+    static const Py_buffer zero_buffer;
+    Py_buffer buffer = zero_buffer;
     if (!PyObject_CheckBuffer(object)) {
         PyErr_Format(PyExc_TypeError, "The destination for %s is not a buffer object", name);
         return buffer;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/segyio.git



More information about the debian-science-commits mailing list