comparison oct-py-eval.cc @ 423:6b9de18b4bdd

Eliminate remaining custom exception handling in favor of Octave errors * oct-py-error.cc, oct-py-error.h (pytave::error_python_exception): New function to generate an Octave error from an active Python error condition, based on pytave::fetch_exception_message. * oct-py-eval.cc (pytave::py_call_function, pytave::py_run_string_safe): Use it. * oct-py-types.cc (pytave::make_py_dict): Likewise. * oct-py-util.cc (pytave::py_objstore): Likewise. * pycall.cc (Fpycall): Remove exception handling logic. * pyeval.cc (Fpyeval): Likewise. * pyexec.cc (Fpyexec): Likewise. * exceptions.cc, exceptions.h: Delete. * Makefile.am (COMMON_SOURCE_FILES, PYTAVE_HEADER_FILES): Remove them.
author Mike Miller <mtmiller@octave.org>
date Thu, 04 May 2017 21:15:07 -0700
parents 24555fba9964
children
comparison
equal deleted inserted replaced
422:8247f298fd16 423:6b9de18b4bdd
27 #include <Python.h> 27 #include <Python.h>
28 #include <string> 28 #include <string>
29 #include <octave/ov.h> 29 #include <octave/ov.h>
30 #include <octave/ovl.h> 30 #include <octave/ovl.h>
31 31
32 #include "exceptions.h" 32 #include "oct-py-error.h"
33 #include "oct-py-eval.h" 33 #include "oct-py-eval.h"
34 #include "oct-py-object.h" 34 #include "oct-py-object.h"
35 #include "oct-py-util.h" 35 #include "oct-py-util.h"
36 #include "oct-py-types.h" 36 #include "oct-py-types.h"
37 37
82 PyObject * 82 PyObject *
83 py_call_function (PyObject *callable, PyObject *args, PyObject *kwargs) 83 py_call_function (PyObject *callable, PyObject *args, PyObject *kwargs)
84 { 84 {
85 python_object retval = PyEval_CallObjectWithKeywords (callable, args, kwargs); 85 python_object retval = PyEval_CallObjectWithKeywords (callable, args, kwargs);
86 if (! retval) 86 if (! retval)
87 throw pytave::error_already_set (); 87 error_python_exception ();
88 88
89 return retval.release (); 89 return retval.release ();
90 } 90 }
91 91
92 PyObject * 92 PyObject *
117 117
118 if (alloc) 118 if (alloc)
119 Py_DECREF (globals); 119 Py_DECREF (globals);
120 120
121 if (! retval) 121 if (! retval)
122 throw pytave::error_already_set (); 122 error_python_exception ();
123 123
124 return retval.release (); 124 return retval.release ();
125 } 125 }
126 126
127 PyObject * 127 PyObject *