annotate oct-py-eval.cc @ 404:aef165ff92b0

Adopt pytave::python_object where objects are local or created and returned * __py_struct_from_dict__.cc, exceptions.cc, oct-py-eval.cc, oct-py-types.cc, pycall.cc: Use pytave::python_object in place of PyObject where objects are created locally and destroyed or returned to the caller.
author Mike Miller <mtmiller@octave.org>
date Fri, 28 Apr 2017 16:21:39 -0700
parents 3644df6564bc
children 3613ffbd52b2
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
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
27 #include <string>
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
28 #include <boost/python.hpp>
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
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
32 #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
33 #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
34 #include "oct-py-util.h"
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
35 #include "octave_to_python.h"
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
36
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
37 namespace pytave
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
38 {
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
39
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
40 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
41 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
42 {
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
43 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
44 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
45 return retval.release ();
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
46 }
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
47
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
48 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
49 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
50 {
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
51 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
52 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
53 return retval.release ();
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
54 }
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
55
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
56 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
57 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
58 {
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
59 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
60 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
61 if (! args_list)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
62 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
63
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
64 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
65 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
66 boost::python::object arg;
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
67 pytave::octvalue_to_pyobj (arg, args(i));
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
68 PyObject *obj = arg.ptr ();
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
69
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
70 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
71 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
72 else
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
73 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
74 Py_INCREF (obj);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
75 PyList_Append (args_list, obj);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
76 }
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
77 }
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 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
80
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
81 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
82
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
83 return retval.release ();
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
84 }
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
85
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
86 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
87 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
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 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
90 if (! retval)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
91 throw boost::python::error_already_set ();
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
92
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
93 return retval.release ();
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
94 }
351
040aff46e4db Refactor calling a Python function into a set of wrapper functions
Mike Miller <mtmiller@octave.org>
parents: 335
diff changeset
95
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
96 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
97 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
98 PyObject *locals)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
99 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
100 bool alloc = false;
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
101
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
102 if (! globals || (globals == Py_None))
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
103 {
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
104 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
105 globals = PyModule_GetDict (main);
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
106 if (! globals)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
107 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
108 globals = PyDict_New ();
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
109 alloc = true;
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
110 }
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
111 }
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
112
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
113 if (! locals || (locals == Py_None))
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
114 locals = globals;
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
115
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
116 // 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
117 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
118
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
119 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
120 &flags);
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
121
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
122 if (alloc)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
123 Py_DECREF (globals);
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
124
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
125 if (! retval)
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
126 throw boost::python::error_already_set ();
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
127
404
aef165ff92b0 Adopt pytave::python_object where objects are local or created and returned
Mike Miller <mtmiller@octave.org>
parents: 403
diff changeset
128 return retval.release ();
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
129 }
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
130
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
131 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
132 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
133 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
134 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
135 }
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
136
402
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
137 PyObject *
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
138 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
139 {
c4b78e449c62 maint: indent functions declared in the pytave namespace
Mike Miller <mtmiller@octave.org>
parents: 363
diff changeset
140 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
141 }
335
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
142
9b862844e6b7 Enable Python print function in evaluated expressions (fixes issue #48)
Mike Miller <mtmiller@octave.org>
parents:
diff changeset
143 }