2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-19 16:32:16 +00:00

This commit was manufactured by cvs2svn to create tag

'merged_to_RC_1_33_0'.

[SVN r31853]
This commit is contained in:
nobody
2005-12-01 13:06:58 +00:00
parent 2e8a265abf
commit 01669c0d5e
11 changed files with 795 additions and 718 deletions

View File

@@ -118,9 +118,9 @@
<td>Windows:&nbsp;<code>c:/Python</code><i>(10*Version)</i>, e.g. <code>c:/Python24</code>
<br>
Unix:&nbsp;<code>/usr/local</code></td>
*nix/Cygwin:&nbsp;<code>/usr</code></td>
<td>On Unix, this should be the <code>--prefix=</code> directory used
<td>On *nix, this should be the <code>--prefix=</code> directory used
to configure Python when it was built and installed.</td>
</tr>
@@ -176,7 +176,7 @@
<tr>
<td><code>CYGWIN_PYTHON_[DEBUG_]ROOT</code></td>
<td>unix-style path containing the <code>include/</code> directory
<td>*nix-style path containing the <code>include/</code> directory
containing
<code>python$(CYGWIN_PYTHON_[DEBUG_]VERSION)/python.h</code>.</td>
@@ -223,8 +223,10 @@
<h3><a name="mingw">Notes for MinGW (and Cygwin with -mno-cygwin) GCC
Users</a></h3>
<p>You will need to create a MinGW-compatible version of the Python
library; the one shipped with Python will only work with a
<p>If you are using a version of Python prior to 2.4.1 with a
MinGW prior to 3.0.0 (with binutils-2.13.90-20030111-1), you will
need to create a MinGW-compatible version of the Python library;
the one shipped with Python will only work with a
Microsoft-compatible linker. Follow the instructions in the
"Non-Microsoft" section of the "Building Extensions: Tips And Tricks"
chapter in <a href=
@@ -363,7 +365,7 @@ path-global BOOST_ROOT : ../../.. ;
<p>The first two variants of the <code>boost_python</code> library are
built by default, and are compatible with the default Python
distribution. The <code>debug-python</code> variant corresponds to a
specially-built debugging version of Python. On Unix platforms, this
specially-built debugging version of Python. On *nix platforms, this
python is built by adding <code>--with-pydebug</code> when configuring
the Python build. On Windows, the debugging version of Python is
generated by the "Win32 Debug" target of the <code>PCBuild.dsw</code>

View File

@@ -1,138 +1,171 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content=
"HTML Tidy for Cygwin (vers 1st April 2002), see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="boost.css">
<head>
<meta name="generator" content=
"HTML Tidy for Cygwin (vers 1st September 2004), see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<link rel="stylesheet" type="text/css" href="boost.css">
<title>Boost.Python - News/Change Log</title>
</head>
<title>Boost.Python - News/Change Log</title>
</head>
<body link="#0000ff" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
"C++ Boost" src="../../../boost.png" border="0"></a></h3>
</td>
<body link="#0000FF" vlink="#800080">
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
"header">
<tr>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt=
"C++ Boost" src="../../../boost.png" border="0"></a></h3>
</td>
<td valign="top">
<h1 align="center"><a href="index.html">Boost.Python</a></h1>
<td valign="top">
<h1 align="center"><a href="index.html">Boost.Python</a></h1>
<h2 align="center">News/Change Log</h2>
</td>
</tr>
</table>
<hr>
<h2 align="center">News/Change Log</h2>
</td>
</tr>
</table>
<hr>
<dl class="page-index">
<dt>14 October 2005 - 1.33.1 release</dt>
<dl class="page-index">
<dt>19 October 2005 - 1.33.1 release</dt>
<dd>
<ul>
<li>The build now assumes Python 2.4 by default, rather than 2.2</li>
<li>Support Python that's built without Unicode support</li>
<li>Support for wrapping classes with overloaded
address-of (<code>&amp;</code>) operators</li>
</ul>
</dd>
<dt>14 August 2005 - 1.33 release</dt>
<dd>
<ul>
<li><code>wrapper&lt;T&gt;</code> can now be used as expected with a
held type of <i>some-smart-pointer</i><code>&lt;T&gt;</code></li>
<dd>
<ul>
<li>Support for docstrings on nonstatic properties.</li>
<li>We now export the client-provided docstrings for <code>init&lt;optional&lt;&gt; &gt;</code> and
<i>XXX</i><code>_FUNCTION_OVERLOADS()</code> for only the last overload.</li>
<li>The build now assumes Python 2.4 by default, rather than 2.2</li>
<li>Fixed some support for Embedded VC++ 4</li>
<li>Support Python that's built without Unicode support</li>
<li>Better support for rvalue from-python conversions of shared_ptr:
always return a pointer that holds the owning python object *unless*
the python object contains a NULL shared_ptr holder of the right type.
</li>
<li>Support for wrapping classes with overloaded address-of
(<code>&amp;</code>) operators</li>
</ul>
</dd>
<li>Support for exposing <code>vector&lt;T*&gt;</code> with the indexing suite.</li>
<li>Support for GCC-3.3 on MacOS.</li>
<li>updated visual studio project build file to include two new files (slice.cpp and wrapper.cpp)</li>
<li>Added search feature to the index page.</li>
<li>Numerous fixes to the tutorial
<li>Numerous workarounds for MSVC 6 and 7, GCC 2.96, and EDG 2.45</li>
</ul>
</dd>
<dt>11 March 2005</dt>
<dt>14 August 2005 - 1.33 release</dt>
<dd>
<ul>
<li>Added a hack that will fool PyDoc into working with Boost.Python, thanks to Nick Rasmussen</li>
</ul>
</dd>
<dt>19 November 2004 - 1.32 release</dt>
<dd>
<ul>
<li>Support for docstrings on nonstatic properties.</li>
<dd>
<ul>
<li>Updated to use the Boost Software License.</li>
<li>A new, <a href="tutorial/doc/html/python/exposing.html#python.class_virtual_functions">better method of wrapping classes with virtual functions</a> has been implemented.</li>
<li>Support for upcoming GCC symbol export control features have been folded in, thanks to Niall Douglas.</li>
<li>Improved support for <code>std::auto_ptr</code>-like types.</li>
<li>The Visual C++ bug that makes top-level <i>cv-qualification</i> of function parameter types part of the function type has been worked around.</li>
<li>Components used by other libraries have been moved out of <code>python/detail</code> and into <code> boost/detail</code> to improve dependency relationships.</li>
<li>Miscellaneous bug fixes and compiler workarounds.</li>
</ul>
</dd>
<dt>8 Sept 2004</dt>
<li>We now export the client-provided docstrings for
<code>init&lt;optional&lt;&gt; &gt;</code> and
<i>XXX</i><code>_FUNCTION_OVERLOADS()</code> for only the last
overload.</li>
<dd>
Support for Python's Bool type, thanks to <a
mailto="dholth-at-fastmail.fm">Daniel Holth</a>.
</dd>
<li>Fixed some support for Embedded VC++ 4</li>
<dt>11 Sept 2003</dt>
<li>Better support for rvalue from-python conversions of shared_ptr:
always return a pointer that holds the owning python object *unless*
the python object contains a NULL shared_ptr holder of the right
type.</li>
<dd>
<ul>
<li>Changed the response to multiple to-python converters being
registered for the same type from a hard error into warning;
Boost.Python now reports the offending type in the message.</li>
<li>Support for exposing <code>vector&lt;T*&gt;</code> with the
indexing suite.</li>
<li>Added builtin <code>std::wstring</code> conversions</li>
<li>Support for GCC-3.3 on MacOS.</li>
<li>Added <code>std::out_of_range</code> =&gt; Python
<code>IndexError</code> exception conversion, thanks to <a href=
"mailto:RaoulGough-at-yahoo.co.uk">Raoul Gough</a></li>
</ul>
</dd>
<li>updated visual studio project build file to include two new files
(slice.cpp and wrapper.cpp)</li>
<dt>9 Sept 2003</dt>
<li>Added search feature to the index page.</li>
<dd>Added new <code><a href="v2/str.html#str-spec">str</a></code></dd>
<li>Numerous fixes to the tutorial</li>
<dt>constructors which take a range of characters, allowing strings
containing nul (<code>'\0'</code>) characters.</dt>
<li>Numerous workarounds for MSVC 6 and 7, GCC 2.96, and EDG
2.45</li>
</ul>
</dd>
<dt>8 Sept 2003</dt>
<dt>11 March 2005</dt>
<dd>Added the ability to create methods from function objects (with an
<code>operator()</code>); see the <a href=
"v2/make_function.html#make_function-spec">make_function</a> docs for
more info.</dd>
<dd>
<ul>
<li>Added a hack that will fool PyDoc into working with Boost.Python,
thanks to Nick Rasmussen</li>
</ul>
</dd>
<dt>10 August 2003</dt>
<dt>19 November 2004 - 1.32 release</dt>
<dd>Added the new <code>properties</code> unit tests contributed by <a
href="mailto:romany-at-actimize.com">Roman Yakovenko</a> and documented
<code>add_static_property</code> at his urging.</dd>
<dd>
<ul>
<li>Updated to use the Boost Software License.</li>
<dt>1 August 2003</dt>
<li>A new, <a href=
"tutorial/doc/html/python/exposing.html#python.class_virtual_functions">
better method of wrapping classes with virtual functions</a> has been
implemented.</li>
<dd>
Added the new <code>arg</code> class contributed by <a href=
"mailto:nickm-at-sitius.com">Nikolay Mladenov</a> which supplies the
ability to wrap functions that can be called with ommitted arguments
in the middle:
<pre>
<li>Support for upcoming GCC symbol export control features have been
folded in, thanks to Niall Douglas.</li>
<li>Improved support for <code>std::auto_ptr</code>-like types.</li>
<li>The Visual C++ bug that makes top-level <i>cv-qualification</i>
of function parameter types part of the function type has been worked
around.</li>
<li>Components used by other libraries have been moved out of
<code>python/detail</code> and into <code>boost/detail</code> to
improve dependency relationships.</li>
<li>Miscellaneous bug fixes and compiler workarounds.</li>
</ul>
</dd>
<dt>8 Sept 2004</dt>
<dd>Support for Python's Bool type, thanks to <a href=
"mailto:dholth-at-fastmail.fm">Daniel Holth</a>.</dd>
<dt>11 Sept 2003</dt>
<dd>
<ul>
<li>Changed the response to multiple to-python converters being
registered for the same type from a hard error into warning;
Boost.Python now reports the offending type in the message.</li>
<li>Added builtin <code>std::wstring</code> conversions</li>
<li>Added <code>std::out_of_range</code> =&gt; Python
<code>IndexError</code> exception conversion, thanks to <a href=
"mailto:RaoulGough-at-yahoo.co.uk">Raoul Gough</a></li>
</ul>
</dd>
<dt>9 Sept 2003</dt>
<dd>Added new <code><a href="v2/str.html#str-spec">str</a></code></dd>
<dt>constructors which take a range of characters, allowing strings
containing nul (<code>'\0'</code>) characters.</dt>
<dt>8 Sept 2003</dt>
<dd>Added the ability to create methods from function objects (with an
<code>operator()</code>); see the <a href=
"v2/make_function.html#make_function-spec">make_function</a> docs for
more info.</dd>
<dt>10 August 2003</dt>
<dd>Added the new <code>properties</code> unit tests contributed by
<a href="mailto:romany-at-actimize.com">Roman Yakovenko</a> and
documented <code>add_static_property</code> at his urging.</dd>
<dt>1 August 2003</dt>
<dd>
Added the new <code>arg</code> class contributed by <a href=
"mailto:nickm-at-sitius.com">Nikolay Mladenov</a> which supplies the
ability to wrap functions that can be called with ommitted arguments in
the middle:
<pre>
void f(int x = 0, double y = 3.14, std::string z = std::string("foo"));
BOOST_PYTHON_MODULE(test)
@@ -141,111 +174,104 @@ BOOST_PYTHON_MODULE(test)
, (arg("x", 0), arg("y", 3.14), arg("z", "foo")));
}
</pre>
And in Python:
<pre>
</pre>And in Python:
<pre>
&gt;&gt;&gt; import test
&gt;&gt;&gt; f(0, z = "bar")
&gt;&gt;&gt; f(z = "bar", y = 0.0)
</pre>
Thanks, Nikolay!
</dd>
</pre>Thanks, Nikolay!
</dd>
<dt>22 July 2003</dt>
<dt>22 July 2003</dt>
<dd>Killed the dreaded "bad argument type for builtin operation" error.
Argument errors now show the actual and expected argument types!</dd>
<dd>Killed the dreaded "bad argument type for builtin operation" error.
Argument errors now show the actual and expected argument types!</dd>
<dt>19 July 2003</dt>
<dt>19 July 2003</dt>
<dd>Added the new <code><a href=
"v2/return_arg.html">return_arg</a></code> policy from <a href=
"mailto:nickm-at-sitius.com">Nikolay Mladenov</a>. Thanks,
Nikolay!</dd>
<dd>Added the new <code><a href=
"v2/return_arg.html">return_arg</a></code> policy from <a href=
"mailto:nickm-at-sitius.com">Nikolay Mladenov</a>. Thanks, Nikolay!</dd>
<dt>18 March, 2003</dt>
<dt>18 March, 2003</dt>
<dd><a href="mailto:Gottfried.Ganssauge-at-haufe.de">Gottfried
Gan&szlig;auge</a> has contributed <a href=
"v2/opaque_pointer_converter.html">opaque pointer support</a>.<br>
<a href="mailto:nicodemus-at-globalite.com.br">Bruno da Silva de Oliveira</a>
has contributed the exciting <a href="../pyste/index.html">Pyste</a>
("Pie-steh") package.</dd>
<dd><a href="mailto:Gottfried.Ganssauge-at-haufe.de">Gottfried
Gan&szlig;auge</a> has contributed <a href=
"v2/opaque_pointer_converter.html">opaque pointer support</a>.<br>
<a href="mailto:nicodemus-at-globalite.com.br">Bruno da Silva de
Oliveira</a> has contributed the exciting <a href=
"../pyste/index.html">Pyste</a> ("Pie-steh") package.</dd>
<dt>24 February 2003</dt>
<dt>24 February 2003</dt>
<dd>Finished improved support for <code>boost::shared_ptr</code>. Now
any wrapped object of C++ class <code>X</code> can be converted
automatically to <code>shared_ptr&lt;X&gt;</code>, regardless of how it
was wrapped. The <code>shared_ptr</code> will manage the lifetime of
the Python object which supplied the <code>X</code>, rather than just
the <code>X</code> object itself, and when such a
<code>shared_ptr</code> is converted back to Python, the original
Python object will be returned.</dd>
<dd>Finished improved support for <code>boost::shared_ptr</code>. Now any
wrapped object of C++ class <code>X</code> can be converted automatically
to <code>shared_ptr&lt;X&gt;</code>, regardless of how it was wrapped.
The <code>shared_ptr</code> will manage the lifetime of the Python object
which supplied the <code>X</code>, rather than just the <code>X</code>
object itself, and when such a <code>shared_ptr</code> is converted back
to Python, the original Python object will be returned.</dd>
<dt>19 January 2003</dt>
<dt>19 January 2003</dt>
<dd>Integrated <code>staticmethod</code> support from <a href=
"mailto:nickm-at-sitius.com">Nikolay Mladenov</a>. Thanks,
Nikolay!</dd>
<dd>Integrated <code>staticmethod</code> support from <a href=
"mailto:nickm-at-sitius.com">Nikolay Mladenov</a>. Thanks, Nikolay!</dd>
<dt>29 December 2002</dt>
<dt>29 December 2002</dt>
<dd>Added Visual Studio project file and instructions from Brett
Calcott. Thanks, Brett!</dd>
<dd>Added Visual Studio project file and instructions from Brett Calcott.
Thanks, Brett!</dd>
<dt>20 December 2002</dt>
<dt>20 December 2002</dt>
<dd>Added automatic downcasting for pointers, references, and smart
pointers to polymorphic class types upon conversion to python</dd>
<dd>Added automatic downcasting for pointers, references, and smart
pointers to polymorphic class types upon conversion to python</dd>
<dt>18 December 2002</dt>
<dt>18 December 2002</dt>
<dd>Optimized from_python conversions for wrapped classes by putting
the conversion logic in the shared library instead of registering
separate converters for each class in each extension module</dd>
<dd>Optimized from_python conversions for wrapped classes by putting the
conversion logic in the shared library instead of registering separate
converters for each class in each extension module</dd>
<dt>19 November 2002</dt>
<dt>19 November 2002</dt>
<dd>Removed the need for users to cast base class member function
pointers when used as arguments to <a href=
"v2/class.html#class_-spec-modifiers">add_property</a></dd>
<dd>Removed the need for users to cast base class member function
pointers when used as arguments to <a href=
"v2/class.html#class_-spec-modifiers">add_property</a></dd>
<dt>13 December 2002</dt>
<dt>13 December 2002</dt>
<dd>Allow exporting of <a href=
"v2/enum.html#enum_-spec"><code>enum_</code></a> values into enclosing
<a href="v2/scope.html#scope-spec"><code>scope</code></a>.<br>
Fixed unsigned integer conversions to deal correctly with numbers that
are out-of-range of <code>signed long</code>.</dd>
<dd>Allow exporting of <a href=
"v2/enum.html#enum_-spec"><code>enum_</code></a> values into enclosing
<a href="v2/scope.html#scope-spec"><code>scope</code></a>.<br>
Fixed unsigned integer conversions to deal correctly with numbers that
are out-of-range of <code>signed long</code>.</dd>
<dt>14 November 2002</dt>
<dt>14 November 2002</dt>
<dd>Auto-detection of class data members wrapped with <a href=
"v2/data_members.html#make_getter-spec"><code>make_getter</code></a></dd>
<dd>Auto-detection of class data members wrapped with <a href=
"v2/data_members.html#make_getter-spec"><code>make_getter</code></a></dd>
<dt>13 November 2002</dt>
<dt>13 November 2002</dt>
<dd>Full Support for <code>std::auto_ptr&lt;&gt;</code> added.</dd>
<dd>Full Support for <code>std::auto_ptr&lt;&gt;</code> added.</dd>
<dt>October 2002</dt>
<dt>October 2002</dt>
<dd>Ongoing updates and improvements to tutorial documentation</dd>
<dd>Ongoing updates and improvements to tutorial documentation</dd>
<dt>10 October 2002</dt>
<dt>10 October 2002</dt>
<dd>Boost.Python V2 is released!</dd>
</dl>
<hr>
<dd>Boost.Python V2 is released!</dd>
</dl>
<hr>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
19 November 2004
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
19 November 2004
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
<p><i>&copy; Copyright <a href="../../../people/dave_abrahams.htm">Dave
Abrahams</a> 2002-2003.</i></p>
</body>
<p><i>&copy; Copyright <a href="../../../people/dave_abrahams.htm">Dave
Abrahams</a> 2002-2003.</i></p>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -29,14 +29,14 @@
# endif
# if defined(BOOST_MSVC)
# if _MSC_VER <= 1200
# if _MSC_VER < 1300
# define BOOST_MSVC6_OR_EARLIER 1
# endif
# pragma warning (disable : 4786) // disable truncated debug symbols
# pragma warning (disable : 4251) // disable exported dll function
# pragma warning (disable : 4800) //'int' : forcing value to bool 'true' or 'false'
# pragma warning (disable : 4275) // non dll-interface class
# pragma warning (disable : 4786) // disable truncated debug symbols
# pragma warning (disable : 4251) // disable exported dll function
# pragma warning (disable : 4800) //'int' : forcing value to bool 'true' or 'false'
# pragma warning (disable : 4275) // non dll-interface class
# elif defined(__ICL) && __ICL < 600 // Intel C++ 5
@@ -68,13 +68,13 @@
#if defined(BOOST_PYTHON_DYNAMIC_LIB)
# if !defined(_WIN32) && !defined(__CYGWIN__) \
&& defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >=5 \
&& !defined(BOOST_PYTHON_GCC_SYMBOL_VISIBILITY)
# define BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY
# if !defined(_WIN32) && !defined(__CYGWIN__) \
&& !defined(BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY) \
&& BOOST_WORKAROUND(__GNUC__, >= 3) && (__GNUC_MINOR__ >=5 || __GNUC__ > 3)
# define BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY 1
# endif
# if defined(BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY)
# if BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY
# if defined(BOOST_PYTHON_SOURCE)
# define BOOST_PYTHON_DECL __attribute__ ((visibility("default")))
# define BOOST_PYTHON_BUILD_DLL

View File

@@ -22,6 +22,26 @@
#ifdef _DEBUG
# ifndef BOOST_DEBUG_PYTHON
# ifdef _MSC_VER
// VC8.0 will complain if system headers are #included both with
// and without _DEBUG defined, so we have to #include all the
// system headers used by pyconfig.h right here.
# include <stddef.h>
# include <stdarg.h>
# include <stdio.h>
# include <stdlib.h>
# include <assert.h>
# include <errno.h>
# include <ctype.h>
# include <wchar.h>
# include <basetsd.h>
# include <io.h>
# include <limits.h>
# include <float.h>
# include <string.h>
# include <math.h>
# include <time.h>
# endif
# undef _DEBUG // Don't let Python force the debug library just because we're debugging.
# define DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H
# endif
@@ -97,7 +117,7 @@ typedef int pid_t;
# define HAVE_LONG_LONG 1
# define LONG_LONG long long
# endif
# endif
# elif defined(__MWERKS__)
@@ -143,6 +163,10 @@ typedef int pid_t;
#ifdef DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H
# undef DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H
# define _DEBUG
# ifdef _CRT_NOFORCE_MANIFEST_DEFINED_FROM_WRAP_PYTHON_H
# undef _CRT_NOFORCE_MANIFEST_DEFINED_FROM_WRAP_PYTHON_H
# undef _CRT_NOFORCE_MANIFEST
# endif
#endif
#if !defined(PY_MAJOR_VERSION) || PY_MAJOR_VERSION < 2

View File

@@ -42,7 +42,7 @@ extern "C" \
} \
void init_module_##name()
# elif (defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >=5)
# elif BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY
# define BOOST_PYTHON_MODULE_INIT(name) \
void init_module_##name(); \

View File

@@ -30,6 +30,10 @@
# include <boost/mpl/for_each.hpp>
# include <boost/mpl/placeholders.hpp>
# include <boost/mpl/single_view.hpp>
# include <boost/mpl/assert.hpp>
# include <boost/type_traits/is_same.hpp>
# include <boost/type_traits/is_convertible.hpp>
# include <boost/noncopyable.hpp>
@@ -49,6 +53,12 @@ struct register_base_of
template <class Base>
inline void operator()(Base*) const
{
# if !BOOST_WORKAROUND(BOOST_MSVC, == 1200)
BOOST_MPL_ASSERT_NOT((is_same<Base,Derived>));
# else
BOOST_STATIC_ASSERT(!(is_same<Base,Derived>::value));
# endif
// Register the Base class
register_dynamic_id<Base>();
@@ -58,7 +68,7 @@ struct register_base_of
// Register the down-cast, if appropriate.
this->register_downcast((Base*)0, is_polymorphic<Base>());
}
private:
static inline void register_downcast(void*, mpl::false_) {}
@@ -186,7 +196,7 @@ struct class_metadata
, mpl::if_<
use_value_holder
, value_holder<T>
, pointer_holder<held_type,T>
, pointer_holder<held_type,wrapped>
>
>::type holder;
@@ -199,7 +209,8 @@ struct class_metadata
template <class T2>
inline static void register_aux(python::wrapper<T2>*)
{
class_metadata::register_aux2((T2*)0, mpl::true_());
typedef typename mpl::not_<is_same<T2,wrapped> >::type use_callback;
class_metadata::register_aux2((T2*)0, use_callback());
}
inline static void register_aux(void*)
@@ -242,6 +253,7 @@ struct class_metadata
//
inline static void maybe_register_class_to_python(void*, mpl::true_) {}
template <class T2>
inline static void maybe_register_class_to_python(T2*, mpl::false_)
{

View File

@@ -55,12 +55,15 @@ namespace detail
}
# endif
# if !defined(BOOST_MSVC) || BOOST_WORKAROUND(_MSC_FULL_VER, > 140040607)
# if defined(BOOST_MSVC) && BOOST_WORKAROUND(_MSC_FULL_VER, <= 140040607) || BOOST_WORKAROUND(BOOST_INTEL_WIN, >= 900)
// No operator T&
# else
template <class T>
operator T&() const
{
converter::return_from_python<T&> converter;
return converter(m_obj.release());
return converter(const_cast<handle<>&>(m_obj).release());
}
# endif

View File

@@ -21,6 +21,14 @@
# ifdef BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE
# if defined(__GNUC__) && __GNUC__ >= 3
// http://lists.debian.org/debian-gcc/2003/09/msg00055.html notes
// that, in cxxabi.h of gcc-3.x for x < 4, this type is used before it
// is declared.
# if __GNUC__ == 3 && __GNUC_MINOR__ < 4
class __class_type_info;
# endif
# include <cxxabi.h>
# endif
# endif

View File

@@ -13,6 +13,14 @@
#include <boost/python/call.hpp>
#include <boost/utility.hpp>
#include <memory>
#ifdef HELD_BY_AUTO_PTR
# define HELD_PTR(X) , std::auto_ptr< X >
#else
# define HELD_PTR(X)
#endif
using namespace boost::python;
struct P
@@ -123,19 +131,23 @@ C& getCCppObj ()
A* pass_a(A* x) { return x; }
#ifdef HELD_BY_AUTO_PTR
BOOST_PYTHON_MODULE_INIT(polymorphism2_auto_ptr_ext)
#else
BOOST_PYTHON_MODULE_INIT(polymorphism2_ext)
#endif
{
class_<ACallback,boost::noncopyable>("A")
class_<ACallback HELD_PTR(A),boost::noncopyable>("A")
.def("f", &A::f, &ACallback::default_f)
;
def("getBCppObj", getBCppObj, return_value_policy<reference_existing_object>());
class_<C,bases<A>,boost::noncopyable>("C")
class_<C HELD_PTR(C),bases<A>,boost::noncopyable>("C")
.def("f", &C::f)
;
class_<DCallback,bases<A>,boost::noncopyable>("D")
class_<DCallback HELD_PTR(D),bases<A>,boost::noncopyable>("D")
.def("f", &D::f)
.def("g", &D::g)
;
@@ -152,7 +164,7 @@ BOOST_PYTHON_MODULE_INIT(polymorphism2_ext)
.def("f", pure_virtual(&P::f))
;
class_<Q, bases<P> >("Q")
class_<Q HELD_PTR(Q), bases<P> >("Q")
.def("g", &P::g) // make sure virtual inheritance doesn't interfere
;
}

View File

@@ -2,7 +2,7 @@
# Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
import unittest
from polymorphism2_ext import *
import sys
class PolymorphTest(unittest.TestCase):
@@ -77,11 +77,18 @@ class PolymorphTest(unittest.TestCase):
r = R()
self.failUnlessEqual ('R.f', r.f())
if __name__ == "__main__":
# remove the option which upsets unittest
def test():
# remove the option that upsets unittest
import sys
sys.argv = [ x for x in sys.argv if x != '--broken-auto-ptr' ]
unittest.main()
# This nasty hack basically says that if we're loaded by another module, we'll
# be testing polymorphism2_auto_ptr_ext instead of polymorphism2_ext.
if __name__ == "__main__":
from polymorphism2_ext import *
test()
else:
from polymorphism2_auto_ptr_ext import *