Update of /cvsroot/boost/boost/libs/python/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16027/libs/python/src

Modified Files:
        exec.cpp 
Log Message:
Add new eval() function.

Index: exec.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/python/src/exec.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- exec.cpp    27 Oct 2006 21:17:25 -0000      1.3
+++ exec.cpp    2 May 2007 13:11:20 -0000       1.4
@@ -13,6 +13,15 @@
 namespace python 
 {
 
+object BOOST_PYTHON_DECL eval(str string, object global, object local)
+{
+  // should be 'char const *' but older python versions don't use 'const' yet.
+  char *s = python::extract<char *>(string);
+  PyObject* result = PyRun_String(s, Py_eval_input, global.ptr(), local.ptr());
+  if (!result) throw_error_already_set();
+  return object(detail::new_reference(result));
+}
+
 object BOOST_PYTHON_DECL exec(str string, object global, object local)
 {
   // should be 'char const *' but older python versions don't use 'const' yet.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to