Update of /cvsroot/boost/boost/libs/python/doc/tutorial/doc
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24352
Modified Files:
tutorial.qbk
Log Message:
More fixes for embedding python docs.
Index: tutorial.qbk
===================================================================
RCS file: /cvsroot/boost/boost/libs/python/doc/tutorial/doc/tutorial.qbk,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- tutorial.qbk 18 May 2007 15:22:42 -0000 1.17
+++ tutorial.qbk 18 May 2007 15:52:54 -0000 1.18
@@ -1520,11 +1520,8 @@
[h2 Exception handling]
-If an exception occurs in the execution of some Python code, the PyRun_String
-function returns a null pointer. Constructing a [^handle] out of this null
-pointer throws [EMAIL PROTECTED]/../../v2/errors.html#error_already_set-spec
error_already_set],
-so basically, the Python exception is automatically translated into a
-C++ exception when using [^handle]:
+If an exception occurs in the evaluation of the python expression,
[EMAIL PROTECTED]/../../v2/errors.html#error_already_set-spec
error_already_set] is thrown:
try
{
@@ -1532,7 +1529,7 @@
// execution will never get here:
int five_divided_by_zero = extract<int>(result);
}
- catch(error_already_set)
+ catch(error_already_set const &)
{
// handle the exception in some way
}
@@ -1546,7 +1543,7 @@
exception with those of the [EMAIL
PROTECTED]://www.python.org/doc/api/standardExceptions.html
standard exceptions]:
- catch(error_already_set)
+ catch(error_already_set const &)
{
if (PyErr_ExceptionMatches(PyExc_ZeroDivisionError))
{
@@ -1562,21 +1559,6 @@
(To retrieve even more information from the exception you can use some of the
other
exception handling functions listed [EMAIL
PROTECTED]://www.python.org/doc/api/exceptionHandling.html here].)
-If you'd rather not have [^handle] throw a C++ exception when it is
constructed, you
-can use the [EMAIL PROTECTED]/../../v2/handle.html#allow_null-spec allow_null]
function in the same
-way you'd use borrowed:
-
- handle<> result((allow_null(PyRun_String(
- "5/0"
- , Py_eval_input
- , main_namespace.ptr()
- , main_namespace.ptr()))));
-
- if (!result)
- // Python exception occurred
- else
- // everything went okay, it's safe to use the result
-
[endsect]
[endsect] [/ Embedding]
-------------------------------------------------------------------------
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