[segyio] 91/376: Exception safe float conversion in python.write

Jørgen Kvalsvik jokva-guest at moszumanska.debian.org
Wed Sep 20 08:04:13 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 85ec81f8790d8b9b1462e156c97d4d9e3291e74d
Author: Jørgen Kvalsvik <jokva at statoil.com>
Date:   Thu Nov 3 11:44:38 2016 +0100

    Exception safe float conversion in python.write
---
 python/segyio/_segyio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/python/segyio/_segyio.c b/python/segyio/_segyio.c
index e787b1f..82ef3e4 100644
--- a/python/segyio/_segyio.c
+++ b/python/segyio/_segyio.c
@@ -808,13 +808,13 @@ static PyObject *py_write_trace(PyObject *self, PyObject *args) {
 
     error = segy_writetrace(p_FILE, trace_no, buffer.buf, trace0, trace_bsize);
 
+    int converr = segy_to_native(format, samples, buffer.buf);
+
     if (error != 0) {
         return py_handle_segy_error_with_index_and_name(error, errno, trace_no, "Trace");
     }
 
-    error = segy_to_native(format, samples, buffer.buf);
-
-    if (error != 0) {
+    if (converr != 0) {
         PyErr_SetString(PyExc_TypeError, "Unable to convert buffer to native format.");
         return NULL;
     }
@@ -905,4 +905,4 @@ static PyMethodDef SegyMethods[] = {
 PyMODINIT_FUNC
 init_segyio(void) {
     (void) Py_InitModule("_segyio", SegyMethods);
-}
\ No newline at end of file
+}

-- 
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