diff --git a/doc/tutorial/doc/quickstart.txt b/doc/tutorial/doc/quickstart.txt
index b6a7d12d..0e202c0b 100644
--- a/doc/tutorial/doc/quickstart.txt
+++ b/doc/tutorial/doc/quickstart.txt
@@ -1458,10 +1458,10 @@ The former returns a reference to an already imported module, the latter
retrieves a module's namespace dictionary. Let's use them to retrieve the
namespace of the [^__main__] module:
- object main_module(
- handle<>(borrowed(PyImport_AddModule("__main__"))));
- object main_namespace = main_module.attr("__dict__");
+ object main_module((
+ handle<>(borrowed(PyImport_AddModule("__main__")))));
+ object main_namespace = main_module.attr("__dict__");
For a function returning a ['new reference] we can just create a [^handle]
out of the raw [^PyObject*] without wrapping it in a call to borrowed. One
@@ -1510,12 +1510,12 @@ For most intents and purposes you can use the namespace dictionary of the
We have already seen how to get the [^__main__] module's namespace so let's
run some Python code in it:
- object main_module(
- handle<>(borrowed(PyImport_AddModule("__main__"))));
+ object main_module((
+ handle<>(borrowed(PyImport_AddModule("__main__")))));
object main_namespace = main_module.attr("__dict__");
- handle<>(PyRun_String(
+ handle<> ignored((PyRun_String(
"hello = file('hello.txt', 'w')\n"
"hello.write('Hello world!')\n"
@@ -1524,7 +1524,7 @@ run some Python code in it:
, Py_file_input
, main_namespace.ptr()
, main_namespace.ptr())
- );
+ ));
Because the Python/C API doesn't know anything about [^object]s, we used
the object's [^ptr] member function to retrieve the [^PyObject*].
@@ -1547,33 +1547,34 @@ named [^object] class and it's derivatives. We've already seen that they
can be constructed from a [^handle]. The following examples should further
illustrate this fact:
- object main_module(
- handle<>(borrowed(PyImport_AddModule("__main__"))));
+ object main_module((
+ handle<>(borrowed(PyImport_AddModule("__main__")))));
object main_namespace = main_module.attr("__dict__");
- handle<>(PyRun_String(
+ handle<> ignored((PyRun_String(
"result = 5 ** 2"
, Py_file_input
, main_namespace.ptr()
, main_namespace.ptr())
- );
+ ));
- int five_squared = extract
- object main_module(
- handle<>(borrowed(PyImport_AddModule("__main__"))));
+ object main_module((
+ handle<>(borrowed(PyImport_AddModule("__main__")))));
+
object main_namespace = main_module.attr("__dict__");
@@ -117,12 +118,12 @@ For most intents and purposes you can use the namespace dictionary of the We have already seen how to get the __main__ module's namespace so let's run some Python code in it:
- object main_module(
- handle<>(borrowed(PyImport_AddModule("__main__"))));
+ object main_module((
+ handle<>(borrowed(PyImport_AddModule("__main__")))));
object main_namespace = main_module.attr("__dict__");
- handle<>(PyRun_String(
+ handle<> ignored((PyRun_String(
"hello = file('hello.txt', 'w')\n"
"hello.write('Hello world!')\n"
@@ -131,7 +132,7 @@ run some Python code in it:
, Py_file_input
, main_namespace.ptr()
, main_namespace.ptr())
- );
+ ));
Because the Python/C API doesn't know anything about objects, we used @@ -155,21 +156,21 @@ named object class and it's derivatives. We've already seen that they can be constructed from a handle. The following examples should further illustrate this fact:
- object main_module(
- handle<>(borrowed(PyImport_AddModule("__main__"))));
+ object main_module((
+ handle<>(borrowed(PyImport_AddModule("__main__")))));
object main_namespace = main_module.attr("__dict__");
- handle<>(PyRun_String(
+ handle<> ignored((PyRun_String(
"result = 5 ** 2"
, Py_file_input
, main_namespace.ptr()
, main_namespace.ptr())
- );
+ ));
- int five_squared = extract<int>(main_namespace["result"] );
+ int five_squared = extract<int>(main_namespace["result"]);
Here we create a dictionary object for the __main__ module's namespace. @@ -179,12 +180,13 @@ the dictionary. Another way to achieve the same result is to let PyRun_String return the result directly with Py_eval_input:
- object result(handle<>(PyRun_String(
- "5 ** 2"
- , Py_eval_input
- , main_namespace.ptr()
- , main_namespace.ptr()))
- );
+ object result((handle<>(
+ PyRun_String("5 ** 2"
+ , Py_eval_input
+ , main_namespace.ptr()
+ , main_namespace.ptr()))
+ ));
+
int five_squared = extract<int>(result);
@@ -199,12 +201,12 @@ error_already_set, so basically, the Python exception is automatically trans
try
{
- object result(handle<>(PyRun_String(
+ object result((handle<>(PyRun_String(
"5/0"
, Py_eval_input
, main_namespace.ptr()
, main_namespace.ptr()))
- );
+ ));
// execution will never get here:
int five_divided_by_zero = extract<int>(result);
@@ -240,11 +242,11 @@ here.)
- handle<> result(allow_null(PyRun_String(
+ handle<> result((allow_null(PyRun_String(
"5/0"
, Py_eval_input
, main_namespace.ptr()
- , main_namespace.ptr())));
+ , main_namespace.ptr()))));
if (!result)
// Python exception occurred
diff --git a/doc/tutorial/doc/virtual_functions_with_default_implementations.html b/doc/tutorial/doc/virtual_functions_with_default_implementations.html
index 6dbb6ff3..c1d28c33 100644
--- a/doc/tutorial/doc/virtual_functions_with_default_implementations.html
+++ b/doc/tutorial/doc/virtual_functions_with_default_implementations.html
@@ -22,7 +22,7 @@



-
+
-
-
- class_<Base, BaseWrap, boost::noncopyable>("Base")
+
+ class_<Base, BaseWrap, BaseWrap, boost::noncopyable>("Base")
.def("f", &Base::f, &BaseWrap::default_f)
-
-
+
Note that we are allowing Base objects to be instantiated this time,
unlike before where we specifically defined the class_<Base> with
@@ -112,7 +110,7 @@ Calling call_f, passing in a derived object:



-
+
Copyright © 2002-2003 David Abrahams
Copyright © 2002-2003 Joel de Guzman