annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
1 /*
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
2
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
3 Copyright (C) 2016 Mike Miller
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
4
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
5 This file is part of Pytave.
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
6
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
7 Pytave is free software; you can redistribute it and/or modify it
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
10 option) any later version.
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
11
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
12 Pytave is distributed in the hope that it will be useful, but WITHOUT
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
15 for more details.
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
16
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
18 along with Pytave; see the file COPYING. If not, see
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
20
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
21 */
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
22
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
23 #if defined (HAVE_CONFIG_H)
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
24 # include <config.h>
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
25 #endif
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
26
421
24555fba9964 Include <Python.h> first to suppress possible redefinition warnings
Mike Miller <mtmiller@octave.org>
parents: 415
diff changeset
27 #include <Python.h>
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
28 #include <string>
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
29 #include <octave/ov.h>
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
30 #include <octave/ovl.h>
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
31
423
6b9de18b4bdd Eliminate remaining custom exception handling in favor of Octave errors
Mike Miller <mtmiller@octave.org>
parents: 421
diff changeset
32 #include "oct-py-error.h"
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
33 #include "oct-py-eval.h"
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
34 #include "oct-py-object.h"
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
35 #include "oct-py-util.h"
411
3613ffbd52b2 Overhaul implicit conversion of arguments and return values
Mike Miller <mtmiller@octave.org>
parents: 404
diff changeset
36 #include "oct-py-types.h"
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
37
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
38 namespace pytave
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
39 {
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
40
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
41 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
42 py_call_function (const std::string& func, const octave_value_list& args)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
43 {
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
44 python_object func_obj = py_find_function (func);
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
45 python_object retval = py_call_function (func_obj, args);
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
46 return retval.release ();
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
47 }
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
48
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
49 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
50 py_call_function (const std::string& func, PyObject *args, PyObject *kwargs)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
51 {
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
52 python_object func_obj = py_find_function (func);
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
53 python_object retval = py_call_function (func_obj, args, kwargs);
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
54 return retval.release ();
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
55 }
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
56
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
57 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
58 py_call_function (PyObject *callable, const octave_value_list& args)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
59 {
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
60 python_object kwargs;
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
61 python_object args_list = PyList_New (0);
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
62 if (! args_list)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
63 octave_throw_bad_alloc ();
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
64
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
65 for (int i = 0; i < args.length (); ++i)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
66 {
411
3613ffbd52b2 Overhaul implicit conversion of arguments and return values
Mike Miller <mtmiller@octave.org>
parents: 404
diff changeset
67 python_object obj = py_implicitly_convert_argument (args(i));
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
68
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
69 if (pytave::is_py_kwargs_argument (obj))
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
70 kwargs = pytave::update_py_dict (kwargs, obj);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
71 else
411
3613ffbd52b2 Overhaul implicit conversion of arguments and return values
Mike Miller <mtmiller@octave.org>
parents: 404
diff changeset
72 PyList_Append (args_list, obj.release ());
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
73 }
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
74
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
75 python_object args_tuple = PyList_AsTuple (args_list);
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
76
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
77 python_object retval = py_call_function (callable, args_tuple, kwargs);
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
78
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
79 return retval.release ();
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
80 }
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
81
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
82 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
83 py_call_function (PyObject *callable, PyObject *args, PyObject *kwargs)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
84 {
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
85 python_object retval = PyEval_CallObjectWithKeywords (callable, args, kwargs);
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
86 if (! retval)
423
6b9de18b4bdd Eliminate remaining custom exception handling in favor of Octave errors
Mike Miller <mtmiller@octave.org>
parents: 421
diff changeset
87 error_python_exception ();
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
88
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
89 return retval.release ();
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
90 }
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
91
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
92 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
93 py_run_string_safe (const std::string& expr, int start, PyObject *globals,
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
94 PyObject *locals)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
95 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
96 bool alloc = false;
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
97
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
98 if (! globals || (globals == Py_None))
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
99 {
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
100 python_object main = py_import_module ("__main__");
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
101 globals = PyModule_GetDict (main);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
102 if (! globals)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
103 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
104 globals = PyDict_New ();
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
105 alloc = true;
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
106 }
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
107 }
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
108
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
109 if (! locals || (locals == Py_None))
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
110 locals = globals;
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
111
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
112 // Evaluate all expressions under "from __future__ import print_function"
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
113 PyCompilerFlags flags { CO_FUTURE_PRINT_FUNCTION };
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
114
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
115 python_object retval = PyRun_StringFlags (expr.c_str (), start, globals, locals,
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
116 &flags);
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
117
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
118 if (alloc)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
119 Py_DECREF (globals);
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
120
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
121 if (! retval)
423
6b9de18b4bdd Eliminate remaining custom exception handling in favor of Octave errors
Mike Miller <mtmiller@octave.org>
parents: 421
diff changeset
122 error_python_exception ();
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
123
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
124 return retval.release ();
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
125 }
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
126
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
127 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
128 py_eval_string (const std::string& expr, PyObject *globals, PyObject *locals)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
129 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
130 return py_run_string_safe (expr, Py_eval_input, globals, locals);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
131 }
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
132
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
133 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
134 py_exec_string (const std::string& expr, PyObject *globals, PyObject *locals)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
135 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
136 return py_run_string_safe (expr, Py_file_input, globals, locals);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
137 }
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
138
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
139 }