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

Compare commits

...

22 Commits

Author SHA1 Message Date
nobody
8e0553b310 This commit was manufactured by cvs2svn to create tag
'Version_1_31_0'.

[SVN r22162]
2004-02-04 15:24:32 +00:00
Joel de Guzman
ccc17a791a small typo
[SVN r22067]
2004-01-30 06:15:32 +00:00
Dave Abrahams
385fe03956 Improved and alphabetized news format, added Python news, updated
iterator news.

Corrections in the Python documentation


[SVN r22038]
2004-01-29 03:01:19 +00:00
Dave Abrahams
1727aa33b3 merged from HEAD
[SVN r22028]
2004-01-28 22:52:26 +00:00
Joel de Guzman
4c7694d81e small typo
[SVN r22026]
2004-01-28 22:45:35 +00:00
Ralf W. Grosse-Kunstleve
36751a0e0a merged from trun
[SVN r21716]
2004-01-14 01:39:40 +00:00
Ralf W. Grosse-Kunstleve
ccd909e98d previous revision (1.10) of this file restored because http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13530 is fixed
[SVN r21633]
2004-01-12 18:02:28 +00:00
Joel de Guzman
01b25510ff fix typo
[SVN r21571]
2004-01-10 02:53:06 +00:00
Ralf W. Grosse-Kunstleve
06beca39af merged from trunk
[SVN r21559]
2004-01-09 07:26:47 +00:00
Dave Abrahams
65c10f8f08 merged from trunk
[SVN r21530]
2004-01-07 14:08:10 +00:00
Ralf W. Grosse-Kunstleve
3c1a4b13b7 merged from trunk: Test full slicing.
[SVN r21508]
2004-01-06 13:09:29 +00:00
Ralf W. Grosse-Kunstleve
157343241c merged from trunk: Workaround for gcc-3.4 quirks
[SVN r21507]
2004-01-06 13:08:25 +00:00
Dave Abrahams
11df3bc2d3 merged from trunk
[SVN r21473]
2004-01-04 13:41:34 +00:00
Dave Abrahams
469094ee45 merged from trunk
[SVN r21450]
2004-01-02 18:34:56 +00:00
Ralf W. Grosse-Kunstleve
ce3d43bb06 merged from trunk
[SVN r21448]
2004-01-02 18:06:01 +00:00
Dave Abrahams
3a3f5631b9 merged from trunk
[SVN r21443]
2004-01-01 12:46:39 +00:00
Ralf W. Grosse-Kunstleve
b6707c8e61 Merged from trunk: workaround for Visual C++ 6 internal compiler error
[SVN r21441]
2004-01-01 01:51:49 +00:00
Ralf W. Grosse-Kunstleve
3b25d2a78d Merged from trunk: workaround for g++ (GCC) 3.4.0 20031230 (experimental) problem
[SVN r21440]
2004-01-01 01:50:07 +00:00
Dave Abrahams
dba4d7bf72 merged from trunk
[SVN r21438]
2003-12-31 19:21:19 +00:00
Ralf W. Grosse-Kunstleve
bf86306f8b work around g++ (GCC) 3.4.0 20031230 (experimental) internal compiler error; http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13530; in case this bug is not fixed before the gcc 3.4 release the boost 1.31.0 release should still compile
[SVN r21431]
2003-12-31 08:45:42 +00:00
Dave Abrahams
e782dd7e02 merged from trunk
[SVN r21430]
2003-12-31 00:25:37 +00:00
nobody
bd4fd372a0 This commit was manufactured by cvs2svn to create branch 'RC_1_31_0'.
[SVN r21427]
2003-12-30 12:10:04 +00:00
36 changed files with 463 additions and 298 deletions

View File

@@ -26,7 +26,7 @@
</table>
<p>
It was mentioned in passing in the previous section that
<tt>BOOST_PYTHON_FUNCTION_OVERLOADS</tt> and <tt>BOOST_PYTHON_FUNCTION_OVERLOADS</tt>
<tt>BOOST_PYTHON_FUNCTION_OVERLOADS</tt> and <tt>BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS</tt>
can also be used for overloaded functions and member functions with a
common sequence of initial arguments. Here is an example:</p>
<code><pre>

View File

@@ -93,7 +93,7 @@ arguments or overloads with a common sequence of initial arguments come
into play. Another macro is provided to make this a breeze.</p>
<p>
Like <tt>BOOST_PYTHON_FUNCTION_OVERLOADS</tt>,
<tt>BOOST_PYTHON_FUNCTION_OVERLOADS</tt> may be used to automatically create
<tt>BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS</tt> may be used to automatically create
the thin wrappers for wrapping member functions. Let's have an example:</p>
<code><pre>
<span class=keyword>struct </span><span class=identifier>george

View File

@@ -63,9 +63,9 @@ Besides bjam, there are of course other ways to get your module built.
What's written here should not be taken as "the one and only way".
There are of course other build tools apart from [^bjam].
Take note however that the preferred build tool for Boost.Python is bjam.
There are so many ways to set up the build incorrectly. Experience shows
that 90% of the "I can't build Boost.Python" problems come from people
Take note however that the preferred build tool for Boost.Python is bjam.
There are so many ways to set up the build incorrectly. Experience shows
that 90% of the "I can't build Boost.Python" problems come from people
who had to use a different tool.
]
@@ -1010,7 +1010,7 @@ arguments or overloads with a common sequence of initial arguments come
into play. Another macro is provided to make this a breeze.
Like [^BOOST_PYTHON_FUNCTION_OVERLOADS],
[^BOOST_PYTHON_FUNCTION_OVERLOADS] may be used to automatically create
[^BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS] may be used to automatically create
the thin wrappers for wrapping member functions. Let's have an example:
struct george
@@ -1058,7 +1058,7 @@ Notice the use of [^init<...>] and [^optional<...>] to signify the default
[page:1 Auto-Overloading]
It was mentioned in passing in the previous section that
[^BOOST_PYTHON_FUNCTION_OVERLOADS] and [^BOOST_PYTHON_FUNCTION_OVERLOADS]
[^BOOST_PYTHON_FUNCTION_OVERLOADS] and [^BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS]
can also be used for overloaded functions and member functions with a
common sequence of initial arguments. Here is an example:
@@ -1698,7 +1698,7 @@ with an example.
We have a C++ library that works with sounds: reading and writing various
formats, applying filters to the sound data, etc. It is named (conveniently)
[^sounds]. Our library already has a neat C++ namespace hierarchy, like so:
[^sounds]. Our library already has a neat C++ namespace hierarchy, like so:
sounds::core
sounds::io
@@ -1718,21 +1718,21 @@ separately with Boost.Python, like this:
{
/* export everything in the sounds::core namespace */
...
}
}
/* file io.cpp */
BOOST_PYTHON_MODULE(io)
{
/* export everything in the sounds::io namespace */
...
}
}
/* file filters.cpp */
BOOST_PYTHON_MODULE(filters)
{
/* export everything in the sounds::filters namespace */
...
}
}
Compiling these files will generate the following Python extensions:
[^core.pyd], [^io.pyd] and [^filters.pyd].
@@ -1753,7 +1753,7 @@ Now, we create this directory structure for our Python package:
The file [^__init__.py] is what tells Python that the directory [^sounds/] is
actually a Python package. It can be a empty file, but can also perform some
magic, that will be shown later.
magic, that will be shown later.
Now our package is ready. All the user has to do is put [^sounds] into his
[@http://www.python.org/doc/current/tut/node8.html#SECTION008110000000000000000 PYTHONPATH] and fire up the interpreter:
@@ -1763,7 +1763,7 @@ Now our package is ready. All the user has to do is put [^sounds] into his
>>> sound = sounds.io.open('file.mp3')
>>> new_sound = sounds.filters.echo(sound, 1.0)
Nice heh?
Nice heh?
This is the simplest way to create hierarchies of packages, but it is not very
flexible. What if we want to add a ['pure] Python function to the filters
@@ -1780,7 +1780,7 @@ little. First, we will have to change the name of the extension modules:
{
...
/* export everything in the sounds::core namespace */
}
}
Note that we added an underscore to the module name. The filename will have to
be changed to [^_core.pyd] as well, and we do the same to the other extension modules.
@@ -1802,7 +1802,7 @@ Now, we change our package hierarchy like so:
Note that we created a directory for each extension module, and added a
__init__.py to each one. But if we leave it that way, the user will have to
access the functions in the core module with this syntax:
access the functions in the core module with this syntax:
>>> import sounds.core._core
>>> sounds.core._core.foo(...)
@@ -1854,7 +1854,7 @@ even after it was already created:
>>> def C_str(self): return 'A C instance!'
>>>
>>> # now we turn it in a member function
>>> C.__str__ = C_str
>>> C.__str__ = C_str
>>>
>>> c = C()
>>> print c
@@ -1874,7 +1874,7 @@ we have a class [^point] in C++:
class_<point>("point")...;
}
If we are using the technique from the previous session, [@creating_packages.html
If we are using the technique from the previous session, [@creating_packages.html
Creating Packages], we can code directly into [^geom/__init__.py]:
from _geom import *
@@ -1882,7 +1882,7 @@ Creating Packages], we can code directly into [^geom/__init__.py]:
# a regular function
def point_str(self):
return str((self.x, self.y))
# now we turn it into a member function
point.__str__ = point_str
@@ -1897,9 +1897,9 @@ This technique has several advantages:
You can even add a little syntactic sugar with the use of metaclasses. Let's
create a special metaclass that "injects" methods in other classes.
# The one Boost.Python uses for all wrapped classes.
# The one Boost.Python uses for all wrapped classes.
# You can use here any class exported by Boost instead of "point"
BoostPythonMetaclass = point.__class__
BoostPythonMetaclass = point.__class__
class injector(object):
class __metaclass__(BoostPythonMetaclass):
@@ -1946,10 +1946,10 @@ class_ definitions in multiple files:
/* file point.cpp */
#include <point.h>
#include <boost/python.hpp>
void export_point()
{
class_<point>("point")...;
class_<point>("point")...;
}
/* file triangle.cpp */
@@ -1962,11 +1962,11 @@ class_ definitions in multiple files:
}
Now you create a file [^main.cpp], which contains the [^BOOST_PYTHON_MODULE]
macro, and call the various export functions inside it.
macro, and call the various export functions inside it.
void export_point();
void export_triangle();
BOOST_PYTHON_MODULE(_geom)
{
export_point();
@@ -1984,15 +1984,15 @@ usual approach:
{
class_<point>("point")...;
class_<triangle>("triangle")...;
}
}
but the memory is kept under control.
but the memory is kept under control.
This method is recommended too if you are developing the C++ library and
exporting it to Python at the same time: changes in a class will only demand
the compilation of a single cpp, instead of the entire wrapper code.
[blurb __note__ If you're exporting your classes with [@../../../pyste/index.html Pyste],
[blurb __note__ If you're exporting your classes with [@../../../pyste/index.html Pyste],
take a look at the [^--multiple] option, that generates the wrappers in
various files as demonstrated here.]

View File

@@ -442,10 +442,10 @@ Breakpoint 1, 0x1e04eff0 in python22!PyOS_Readline ()
If you are launching your extension module tests with <a href=
"../../../../tools/build/v1/build_system.htm">Boost.Build</a> using the
<code>boost-python-runtest</code> rule, you can ask it to launch your
debugger for you by adding "-sPYTHON_LAUNCH=<i>debugger</i>" to your bjam
debugger for you by adding "--debugger=<i>debugger</i>" to your bjam
command-line:
<pre>
bjam -sTOOLS=metrowerks "-sPYTHON_LAUNCH=devenv /debugexe" test
bjam -sTOOLS=vc7.1 "--debugger=devenv /debugexe" test
bjam -sTOOLS=gcc -sPYTHON_LAUNCH=gdb test
</pre>
It can also be extremely useful to add the <code>-d+2</code> option when
@@ -873,7 +873,7 @@ BOOST_PYTHON_MODULE(custom_string)
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
10 November, 2003
28 January, 2004
<!--webbot bot="Timestamp" endspan i-checksum="39359" -->
</p>

View File

@@ -278,7 +278,7 @@
std::vector interface]) classes (currently, this is the only predefined
suite available). It provides all the policies required by the
<tt>indexing_suite</tt>.
</p>
</p>
<p>
Example usage:
</p>
@@ -300,16 +300,16 @@
<h2>
<a name="indexing_suite_class"></a>indexing_suite class
</h2>
<h3>
Class template<br>
<tt>indexing_suite&lt;<br>
class <font color="#007F00">Container</font><br>
, class <font color="#007F00">DerivedPolicies<br></font></tt> <tt>,
bool <font color="#007F00">NoProxy</font><br>
, bool <font color="#007F00">NoProxy</font>,<br>
, class <font color="#007F00">Element</font><br>
, class <font color="#007F00">Key</font><br>
, class <font color="#007F00">Index</font></tt>
<h3>
<br>
<tt>indexing_suite&lt;<br>
class Container<br>
, class DerivedPolicies<font color="#007F00"><br>
</font></tt> <tt>,
bool NoProxy<br>
, class Element<br>
, class Key<br>
, class Index</tt>
</h3>
<table width="100%" border="1">
<tr>

View File

@@ -27,8 +27,15 @@
</tr>
</table>
<hr>
<b>Boost.Python</b> has been successfully tested on the following
platforms and compilers:
Please see
our <a
href="http://boost.sourceforge.net/regression-logs">regression
logs</a> for up-to-date information. Note that logs not marked
otherwise reflect the CVS state, not the condition of the release.
<p>
Earlier versions of <b>Boost.Python</b> have been successfully
tested on the following platforms and compilers.
<dl class="page-index">
<dt>Unix Platforms:</dt>

View File

@@ -47,6 +47,12 @@ namespace detail
}
keyword elements[nkeywords];
keywords<nkeywords+1>
operator,(arg const &k) const;
keywords<nkeywords + 1>
operator,(char const *name) const;
};
template <std::size_t nkeywords>
@@ -77,14 +83,25 @@ namespace detail
};
template <std::size_t nkeywords>
keywords<nkeywords+1> operator,(keywords<nkeywords> const& l, const keywords<1> &k)
inline
keywords<nkeywords+1>
keywords_base<nkeywords>::operator,(arg const &k) const
{
keywords<nkeywords> const& l = *static_cast<keywords<nkeywords> const*>(this);
python::detail::keywords<nkeywords+1> res;
std::copy(l.elements, l.elements+nkeywords, res.elements);
res.elements[nkeywords] = k.elements[0];
return res;
}
template <std::size_t nkeywords>
inline
keywords<nkeywords + 1>
keywords_base<nkeywords>::operator,(char const *name) const
{
return this->operator,(python::arg(name));
}
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template<typename T>
struct is_keywords
@@ -136,16 +153,6 @@ namespace detail
# endif
}
namespace detail
{
template <std::size_t nkeywords>
inline keywords<nkeywords + 1>
operator,(keywords<nkeywords> const& l, char *name)
{
return l.operator,(arg(name));
}
}
inline detail::keywords<1> args(char const* name)
{
return detail::keywords<1>(name);

View File

@@ -40,7 +40,10 @@ namespace boost { namespace python {
# endif // CALL_DWA2002411_HPP
#elif BOOST_PP_ITERATION_DEPTH() == 1
# line BOOST_PP_LINE(__LINE__, call.hpp)
# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
&& BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
# line BOOST_PP_LINE(__LINE__, call.hpp)
# endif
# define N BOOST_PP_ITERATION()

View File

@@ -39,7 +39,10 @@ namespace boost { namespace python {
# endif // CALL_METHOD_DWA2002411_HPP
#elif BOOST_PP_ITERATION_DEPTH() == 1
# line BOOST_PP_LINE(__LINE__, call_method.hpp)
# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
&& BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
# line BOOST_PP_LINE(__LINE__, call_method.hpp)
# endif
# define N BOOST_PP_ITERATION()

View File

@@ -47,8 +47,14 @@
# include <boost/utility.hpp>
# include <boost/detail/workaround.hpp>
# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004) || BOOST_WORKAROUND(__GNUC__, < 3)
# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004) \
/* pro9 reintroduced the bug */ \
|| (BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
&& BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) \
|| BOOST_WORKAROUND(__GNUC__, < 3)
# define BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING 1
# endif
# ifdef BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING
@@ -127,7 +133,6 @@ namespace detail
register_wrapper_class_impl((Held*)0, (T*)0, 0);
}
# ifdef BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING
template <class T>
struct is_data_member_pointer
: mpl::and_<
@@ -135,15 +140,17 @@ namespace detail
, mpl::not_<is_member_function_pointer<T> >
>
{};
# define BOOST_PYTHON_DATA_MEMBER_HELPER , detail::is_data_member_pointer<D>()
# ifdef BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING
# define BOOST_PYTHON_DATA_MEMBER_HELPER(D) , detail::is_data_member_pointer<D>()
# define BOOST_PYTHON_YES_DATA_MEMBER , mpl::true_
# define BOOST_PYTHON_NO_DATA_MEMBER , mpl::false_
# elif defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
# define BOOST_PYTHON_DATA_MEMBER_HELPER , 0
# define BOOST_PYTHON_DATA_MEMBER_HELPER(D) , 0
# define BOOST_PYTHON_YES_DATA_MEMBER , int
# define BOOST_PYTHON_NO_DATA_MEMBER , ...
# else
# define BOOST_PYTHON_DATA_MEMBER_HELPER
# define BOOST_PYTHON_DATA_MEMBER_HELPER(D)
# define BOOST_PYTHON_YES_DATA_MEMBER
# define BOOST_PYTHON_NO_DATA_MEMBER
# endif
@@ -337,39 +344,39 @@ class class_ : public objects::class_base
template <class D>
self& def_readonly(char const* name, D const& d)
{
return this->def_readonly_impl(name, d BOOST_PYTHON_DATA_MEMBER_HELPER);
return this->def_readonly_impl(name, d BOOST_PYTHON_DATA_MEMBER_HELPER(D));
}
template <class D>
self& def_readwrite(char const* name, D const& d)
{
return this->def_readwrite_impl(name, d BOOST_PYTHON_DATA_MEMBER_HELPER);
return this->def_readwrite_impl(name, d BOOST_PYTHON_DATA_MEMBER_HELPER(D));
}
template <class D>
self& def_readonly(char const* name, D& d)
{
return this->def_readonly_impl(name, d BOOST_PYTHON_DATA_MEMBER_HELPER);
return this->def_readonly_impl(name, d BOOST_PYTHON_DATA_MEMBER_HELPER(D));
}
template <class D>
self& def_readwrite(char const* name, D& d)
{
return this->def_readwrite_impl(name, d BOOST_PYTHON_DATA_MEMBER_HELPER);
return this->def_readwrite_impl(name, d BOOST_PYTHON_DATA_MEMBER_HELPER(D));
}
// Property creation
template <class Get>
self& add_property(char const* name, Get fget)
{
base::add_property(name, make_fn(fget));
base::add_property(name, this->make_getter(fget));
return *this;
}
template <class Get, class Set>
self& add_property(char const* name, Get fget, Set fset)
{
base::add_property(name, make_fn(fget), make_fn(fset));
base::add_property(name, this->make_getter(fget), this->make_setter(fset));
return *this;
}
@@ -415,25 +422,55 @@ class class_ : public objects::class_base
}
private: // helper functions
// Builds a method for this class around the given [member]
// function pointer or object, appropriately adjusting the type of
// the first signature argument so that if f is a member of a
// (possibly not wrapped) base class of T, an lvalue argument of
// type T will be required.
//
// @group make_fn {
// @group PropertyHelpers {
template <class F>
object make_fn(F const& f)
object make_getter(F f)
{
return make_function(f, default_call_policies(), detail::get_signature(f, (T*)0));
typedef typename api::is_object_operators<F>::type is_obj_or_proxy;
return this->make_fn_impl(
f, is_obj_or_proxy(), (char*)0, detail::is_data_member_pointer<F>()
);
}
template <class F>
object make_setter(F f)
{
typedef typename api::is_object_operators<F>::type is_obj_or_proxy;
return this->make_fn_impl(
f, is_obj_or_proxy(), (int*)0, detail::is_data_member_pointer<F>()
);
}
template <class F>
object make_fn_impl(F const& f, mpl::false_, void*, mpl::false_)
{
return python::make_function(f, default_call_policies(), detail::get_signature(f, (T*)0));
}
object
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
const&
# endif
make_fn(object const& x)
template <class D, class B>
object make_fn_impl(D B::*pm_, mpl::false_, char*, mpl::true_)
{
D T::*pm = pm_;
return python::make_getter(pm);
}
template <class D, class B>
object make_fn_impl(D B::*pm_, mpl::false_, int*, mpl::true_)
{
D T::*pm = pm_;
return python::make_setter(pm);
}
template <class F>
object make_fn_impl(F const& x, mpl::true_, void*, mpl::false_)
{
return x;
}
@@ -443,30 +480,28 @@ class class_ : public objects::class_base
self& def_readonly_impl(
char const* name, D B::*pm_ BOOST_PYTHON_YES_DATA_MEMBER)
{
D T::*pm = pm_;
return this->add_property(name, make_getter(pm));
return this->add_property(name, pm_);
}
template <class D, class B>
self& def_readwrite_impl(
char const* name, D B::*pm_ BOOST_PYTHON_YES_DATA_MEMBER)
{
D T::*pm = pm_;
return this->add_property(name, make_getter(pm), make_setter(pm));
return this->add_property(name, pm_, pm_);
}
template <class D>
self& def_readonly_impl(
char const* name, D& d BOOST_PYTHON_NO_DATA_MEMBER)
{
return this->add_static_property(name, make_getter(d));
return this->add_static_property(name, python::make_getter(d));
}
template <class D>
self& def_readwrite_impl(
char const* name, D& d BOOST_PYTHON_NO_DATA_MEMBER)
{
return this->add_static_property(name, make_getter(d), make_setter(d));
return this->add_static_property(name, python::make_getter(d), python::make_setter(d));
}
inline void register_() const;

View File

@@ -41,19 +41,11 @@
namespace boost { namespace python { namespace detail {
# if 0 // argpkg
template <class N>
inline PyObject* get(N, PyObject* const& args_)
{
return PyTuple_GET_ITEM(args_,N::value);
}
# else
template <unsigned N>
inline PyObject* get(PyObject* const& args_ BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(unsigned,N))
template <int N>
inline PyObject* get(mpl::int_<N>, PyObject* const& args_)
{
return PyTuple_GET_ITEM(args_,N);
}
# endif
inline unsigned arity(PyObject* const& args_)
{
@@ -106,21 +98,12 @@ struct caller;
# define BOOST_PYTHON_NEXT(init,name,n) \
typedef BOOST_PP_IF(n,typename BOOST_PP_CAT(name,BOOST_PP_DEC(n)) ::next, init) name##n;
# if 0 // argpkg
# define BOOST_PYTHON_ARG_CONVERTER(n) \
BOOST_PYTHON_NEXT(typename first::next, arg_iter,n) \
typedef arg_from_python<BOOST_DEDUCED_TYPENAME arg_iter##n::type> c_t##n; \
c_t##n c##n(get(mpl::int_<n>(), inner_args)); \
if (!c##n.convertible()) \
return 0;
# else
# define BOOST_PYTHON_ARG_CONVERTER(n) \
BOOST_PYTHON_NEXT(typename first::next, arg_iter,n) \
typedef arg_from_python<BOOST_DEDUCED_TYPENAME arg_iter##n::type> c_t##n; \
c_t##n c##n(get<n>(inner_args)); \
if (!c##n.convertible()) \
return 0;
# endif
# define BOOST_PP_ITERATION_PARAMS_1 \
(3, (0, BOOST_PYTHON_MAX_ARITY + 1, <boost/python/detail/caller.hpp>))

View File

@@ -14,36 +14,39 @@
# include <boost/type_traits/is_reference.hpp>
# include <boost/type_traits/add_reference.hpp>
# define BOOST_PYTHON_IS_XXX_DEF(name, qualified_name, nargs) \
template <class X_> \
struct is_##name \
{ \
typedef char yes; \
typedef char (&no)[2]; \
\
static typename add_reference<X_>::type dummy; \
\
template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class U) > \
static yes test( \
qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, U) >&, int \
); \
\
template <class U> \
static no test(U&, ...); \
\
BOOST_STATIC_CONSTANT( \
bool, value \
= !is_reference<X_>::value \
& (sizeof(test(dummy, 0)) == sizeof(yes))); \
\
typedef mpl::bool_<value> type; \
# define BOOST_PYTHON_IS_XXX_DEF(name, qualified_name, nargs) \
template <class X_> \
struct is_##name \
{ \
typedef char yes; \
typedef char (&no)[2]; \
\
static typename add_reference<X_>::type dummy; \
\
struct helpers \
{ \
template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class U) > \
static yes test( \
qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, U) >&, int \
); \
\
template <class U> \
static no test(U&, ...); \
}; \
\
BOOST_STATIC_CONSTANT( \
bool, value \
= !is_reference<X_>::value \
& (sizeof(helpers::test(dummy, 0)) == sizeof(yes))); \
\
typedef mpl::bool_<value> type; \
};
# else
# define BOOST_PYTHON_IS_XXX_DEF(name, qualified_name, nargs) \
template <class T> \
struct is_##name : mpl::false_ \
struct is_##name : mpl::false_ \
{ \
}; \
\
@@ -51,7 +54,7 @@ template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class T) > \
struct is_##name< \
qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, T) > \
> \
: mpl::true_ \
: mpl::true_ \
{ \
};

View File

@@ -88,7 +88,10 @@ result(X const&, short = 0) { return 0; }
/* --------------- function pointers --------------- */
#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_FUNCTION_POINTER
# line BOOST_PP_LINE(__LINE__, result.hpp(function pointers))
# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
&& BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
# line BOOST_PP_LINE(__LINE__, result.hpp(function pointers))
# endif
# define N BOOST_PP_ITERATION()
@@ -108,7 +111,10 @@ boost::type<R>* result(R (*pf)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)), int = 0)
# include BOOST_PP_ITERATE()
#elif BOOST_PP_ITERATION_DEPTH() == 2
# line BOOST_PP_LINE(__LINE__, result.hpp(pointers-to-members))
# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
&& BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
# line BOOST_PP_LINE(__LINE__, result.hpp(pointers-to-members))
# endif
// Inner over arities
# define N BOOST_PP_ITERATION()

View File

@@ -39,7 +39,10 @@ T& (* target(R (T::*)) )() { return 0; }
/* --------------- function pointers --------------- */
#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_FUNCTION_POINTER
# line BOOST_PP_LINE(__LINE__, target.hpp(function_pointers))
# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
&& BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
# line BOOST_PP_LINE(__LINE__, target.hpp(function_pointers))
# endif
# define N BOOST_PP_ITERATION()
@@ -59,7 +62,10 @@ BOOST_PP_IF(N, A0, void)(* target(R (*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A))) )()
# include BOOST_PP_ITERATE()
#elif BOOST_PP_ITERATION_DEPTH() == 2
# line BOOST_PP_LINE(__LINE__, target.hpp(pointers-to-members))
# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
&& BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
# line BOOST_PP_LINE(__LINE__, target.hpp(pointers-to-members))
# endif
// Inner over arities
# define N BOOST_PP_ITERATION()

View File

@@ -38,13 +38,13 @@ class long_ : public detail::long_base
template <class T>
explicit long_(T const& rhs)
: base(object(rhs))
: detail::long_base(object(rhs))
{
}
template <class T, class U>
explicit long_(T const& rhs, U const& base)
: base(object(rhs), object(base))
: detail::long_base(object(rhs), object(base))
{
}

View File

@@ -85,19 +85,11 @@ namespace detail
BaseArgs base;
};
# if 0
template <class N, class BaseArgs, class Offset>
inline PyObject* get(N, offset_args<BaseArgs,Offset> const& args_)
template <int N, class BaseArgs, class Offset>
inline PyObject* get(mpl::int_<N>, offset_args<BaseArgs,Offset> const& args_)
{
return get(mpl::int_<(N::value+Offset::value)>(), args_.base);
return get(mpl::int_<(N+Offset::value)>(), args_.base);
}
# else
template <unsigned N, class BaseArgs, class Offset>
inline PyObject* get(offset_args<BaseArgs,Offset> const& args_ BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(unsigned,N))
{
return get<(N + Offset::value)>(args_.base);
}
# endif
template <class BaseArgs, class Offset>
inline unsigned arity(offset_args<BaseArgs,Offset> const& args_)

View File

@@ -45,7 +45,10 @@ template <int nargs> struct make_holder;
# endif // MAKE_HOLDER_DWA20011215_HPP
#elif BOOST_PP_ITERATION_DEPTH() == 1
# line BOOST_PP_LINE(__LINE__, make_holder.hpp)
# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \
&& BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201)))
# line BOOST_PP_LINE(__LINE__, make_holder.hpp)
# endif
# define N BOOST_PP_ITERATION()

View File

@@ -146,6 +146,9 @@ namespace api
const_object_slice slice(object_cref, slice_nil) const;
object_slice slice(object_cref, slice_nil);
const_object_slice slice(slice_nil, slice_nil) const;
object_slice slice(slice_nil, slice_nil);
template <class T, class V>
const_object_slice
slice(T const& start, V const& end) const

View File

@@ -17,8 +17,6 @@
namespace boost { namespace python { namespace api {
# if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE)
template <class X>
char is_object_operators_helper(object_operators<X> const*);
@@ -27,7 +25,7 @@ no_type is_object_operators_helper(...);
template <class X> X* make_ptr();
template <class L, class R>
template <class L, class R = L>
struct is_object_operators
{
enum {
@@ -40,6 +38,7 @@ struct is_object_operators
typedef mpl::bool_<value> type;
};
# if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE)
template <class L, class R, class T>
struct enable_binary
: boost::iterators::enable_if<is_object_operators<L,R>, T>

View File

@@ -63,6 +63,22 @@ object_operators<U>::slice(slice_nil, object_cref finish) const
return const_object_slice(x, std::make_pair(allow_null((PyObject*)0), borrowed(finish.ptr())));
}
template <class U>
object_slice
object_operators<U>::slice(slice_nil, slice_nil)
{
object_cref2 x = *static_cast<U*>(this);
return object_slice(x, std::make_pair(allow_null((PyObject*)0), allow_null((PyObject*)0)));
}
template <class U>
const_object_slice
object_operators<U>::slice(slice_nil, slice_nil) const
{
object_cref2 x = *static_cast<U const*>(this);
return const_object_slice(x, std::make_pair(allow_null((PyObject*)0), allow_null((PyObject*)0)));
}
template <class U>
object_slice
object_operators<U>::slice(object_cref start, slice_nil)

View File

@@ -11,9 +11,7 @@
# include <boost/type_traits/add_reference.hpp>
# include <boost/type_traits/add_const.hpp>
# if 0 // argpkg
# include <boost/mpl/int.hpp>
# endif
# include <boost/mpl/int.hpp>
# include <boost/static_assert.hpp>
# include <boost/python/refcount.hpp>
@@ -86,11 +84,7 @@ struct return_arg : Base
if (!result)
return 0;
Py_DECREF(result);
# if 0 // argpkg
return incref( detail::get(mpl::int_<arg_pos-1>(),args) );
# else
return incref( detail::get<(arg_pos-1)>(args) );
# endif
}
};

View File

@@ -17,8 +17,9 @@
# include <boost/type_traits/same_traits.hpp>
# ifndef BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE
# if defined(__GNUC__) \
&& ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
# if defined(__GNUC__) \
&& ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) \
&& !defined(__EDG_VERSION__)
# define BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE
# endif
# endif

View File

@@ -16,13 +16,14 @@ namespace boost { namespace python {
namespace detail
{
template <unsigned N>
template <std::size_t N>
struct get_prev
{
template <class ArgumentPackage>
static PyObject* execute(ArgumentPackage const& args, PyObject*)
static PyObject* execute(ArgumentPackage const& args, PyObject* = 0)
{
return get<(N-1)>(args);
int const pre_n = static_cast<int>(N) - 1; // separate line is gcc-2.96 workaround
return detail::get(mpl::int_<pre_n>(), args);
}
};
template <>
@@ -59,13 +60,9 @@ struct with_custodian_and_ward : BasePolicy_
return false;
}
# if 0 // argpkg
PyObject* patient = detail::get(mpl::int_<(ward-1)>(), args_);
PyObject* nurse = detail::get(mpl::int_<(custodian-1)>(), args_);
# else
PyObject* patient = detail::get<(ward-1)>(args_);
PyObject* nurse = detail::get<(custodian-1)>(args_);
# endif
PyObject* patient = detail::get_prev<ward>::execute(args_);
PyObject* nurse = detail::get_prev<custodian>::execute(args_);
PyObject* life_support = python::objects::make_nurse_and_patient(nurse, patient);
if (life_support == 0)
return false;
@@ -97,13 +94,9 @@ struct with_custodian_and_ward_postcall : BasePolicy_
return 0;
}
# if 0 // argpkg
PyObject* patient = ward > 0 ? detail::get(mpl::int_<(ward-1)>(),args_) : result;
PyObject* nurse = custodian > 0 ? detail::get(mpl::int_<(custodian-1)>(),args_) : result;
# else
PyObject* patient = detail::get_prev<ward>::execute(args_, result);
PyObject* nurse = detail::get_prev<custodian>::execute(args_, result);
# endif
if (nurse == 0) return 0;
result = BasePolicy_::postcall(args_, result);

View File

@@ -13,7 +13,7 @@
#include <cstdlib>
#include <cstring>
#if !defined(__GNUC__) || __GNUC__ >= 3 || __SGI_STL_PORT
#if !defined(__GNUC__) || __GNUC__ >= 3 || __SGI_STL_PORT || __EDG_VERSION__
# include <ostream>
#else
# include <ostream.h>
@@ -33,10 +33,19 @@ namespace boost { namespace python {
# if __GNUC__ < 3
namespace cxxabi = :: ;
# else
extern "C" char* __cxa_demangle(char const*, char*, std::size_t*, int*);
# else
namespace cxxabi = ::abi; // GCC 3.1 and later
# if __GNUC__ == 3 && __GNUC_MINOR__ == 0
namespace abi
{
extern "C" char* __cxa_demangle(char const*, char*, std::size_t*, int*);
}
# endif
# endif
# endif
# endif
namespace
{

View File

@@ -33,11 +33,8 @@ BOOST_PYTHON_DECL void init_module(char const* name, void(*init_function)())
if (m != 0)
{
// Create the current module scope
scope current_module(
(object(
((borrowed_reference_t*)m)
))
);
object m_obj(((borrowed_reference_t*)m));
scope current_module(m_obj);
handle_exception(init_function);
}

View File

@@ -32,7 +32,7 @@ extern "C"
((life_support*)self)->patient = 0;
// Let the weak reference die. This probably kills us.
Py_XDECREF(PyTuple_GET_ITEM(arg, 0));
return detail::none();
return ::boost::python::detail::none();
}
}

View File

@@ -21,10 +21,13 @@ rule turn-off-intel-debug-symbols ( toolset variant : properties * )
}
return $(properties) ;
}
local UNIT_TEST_PROPERTIES = $(PYTHON_PROPERTIES) <define>BOOST_PYTHON_SUPPRESS_REGISTRY_INITIALIZATION
[ difference $(PYTHON_PROPERTIES) : <define>BOOST_PYTHON_DYNAMIC_LIB ] <define>BOOST_PYTHON_STATIC_LIB ;
template py-unit-test
:
: $(PYTHON_PROPERTIES) <define>BOOST_PYTHON_SUPPRESS_REGISTRY_INITIALIZATION
[ difference $(PYTHON_PROPERTIES) : <define>BOOST_PYTHON_DYNAMIC_LIB ] <define>BOOST_PYTHON_STATIC_LIB
;
# Convenience rule makes declaring tests faster
rule bpl-test ( name ? : files * : requirements * )
{
@@ -61,16 +64,17 @@ rule bpl-test ( name ? : files * : requirements * )
m = $(m)_ext ;
}
}
extension $(m) : $(f) <dll>../build/boost_python : $(requirements) ;
extension $(m) : $(f) <template>../build/extension : $(requirements) ;
modules += $(m) ;
}
}
return [ boost-python-runtest $(name) : $(py) <pyd>$(modules) ] ;
return [ boost-python-runtest $(name) : $(py) <pyd>$(modules) : $(requirements) ] ;
}
test-suite python
: [
:
[
run ../test/embedding.cpp <lib>../build/boost_python
: # program args
: # input files
@@ -82,7 +86,7 @@ test-suite python
<$(gcc-compilers)><debug-python><library-path>$(CYGWIN_PYTHON_DEBUG_DLL_PATH)
<$(gcc-compilers)><*><library-path>$(CYGWIN_PYTHON_DLL_PATH)
<find-library>$(PYTHON_EMBEDDED_LIBRARY)
]
]
[
bpl-test crossmod_exception
@@ -106,7 +110,7 @@ bpl-test crossmod_exception
[ bpl-test keywords : keywords.cpp keywords_test.py ]
[ extension builtin_converters : test_builtin_converters.cpp <dll>../build/boost_python ]
[ extension builtin_converters : test_builtin_converters.cpp <template>../build/extension ]
[ boost-python-runtest builtin_converters : test_builtin_converters.py <pyd>builtin_converters ]
[ bpl-test test_pointer_adoption ]
@@ -164,45 +168,30 @@ bpl-test crossmod_exception
[ run indirect_traits_test.cpp ]
[ run destroy_test.cpp ]
[ run pointer_type_id_test.cpp <lib>../../test/build/boost_test_exec_monitor : : : $(UNIT_TEST_PROPERTIES) ]
[ run bases.cpp : : : $(UNIT_TEST_PROPERTIES) ]
[ run pointer_type_id_test.cpp <lib>../../test/build/boost_test_exec_monitor <template>py-unit-test ]
[ run bases.cpp <template>py-unit-test ]
[ run if_else.cpp ]
[ run pointee.cpp : : : $(UNIT_TEST_PROPERTIES) ]
[ run pointee.cpp <template>py-unit-test ]
[ run result.cpp ]
[ compile string_literal.cpp ]
[ compile borrowed.cpp : $(UNIT_TEST_PROPERTIES) ]
[ compile object_manager.cpp : $(UNIT_TEST_PROPERTIES) ]
[ compile copy_ctor_mutates_rhs.cpp : $(UNIT_TEST_PROPERTIES) ]
[ compile borrowed.cpp <template>py-unit-test ]
[ compile object_manager.cpp <template>py-unit-test ]
[ compile copy_ctor_mutates_rhs.cpp <template>py-unit-test ]
[ run upcast.cpp <lib>../../test/build/boost_test_exec_monitor
: # command-line args
: # input files
: $(UNIT_TEST_PROPERTIES)
]
[ run upcast.cpp <lib>../../test/build/boost_test_exec_monitor <template>py-unit-test ]
[ run select_holder.cpp <lib>../../test/build/boost_test_exec_monitor <template>py-unit-test ]
[ run select_from_python_test.cpp ../src/converter/type_id.cpp
<lib>../../test/build/boost_test_exec_monitor <template>py-unit-test ]
[ run select_holder.cpp <lib>../../test/build/boost_test_exec_monitor
: # command-line args
: # input files
: $(UNIT_TEST_PROPERTIES)
]
[ run select_arg_to_python_test.cpp ../src/converter/type_id.cpp
<lib>../../test/build/boost_test_exec_monitor <template>py-unit-test ]
[ run select_from_python_test.cpp ../src/converter/type_id.cpp <lib>../../test/build/boost_test_exec_monitor
: # command-line args
: # input files
: $(UNIT_TEST_PROPERTIES)
]
[ run select_arg_to_python_test.cpp ../src/converter/type_id.cpp <lib>../../test/build/boost_test_exec_monitor
: # command-line args
: # input files
: $(UNIT_TEST_PROPERTIES)
]
[ compile-fail ./raw_pyobject_fail1.cpp : $(PYTHON_PROPERTIES) ]
[ compile-fail ./raw_pyobject_fail2.cpp : $(PYTHON_PROPERTIES) ]
[ compile-fail ./as_to_python_function.cpp : $(PYTHON_PROPERTIES) ]
[ compile-fail ./object_fail1.cpp : $(PYTHON_PROPERTIES) ]
[ compile-fail ./raw_pyobject_fail1.cpp <template>py-unit-test ]
[ compile-fail ./raw_pyobject_fail2.cpp <template>py-unit-test ]
[ compile-fail ./as_to_python_function.cpp <template>py-unit-test ]
[ compile-fail ./object_fail1.cpp <template>py-unit-test ]
;
}

View File

@@ -4,6 +4,7 @@
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
#include <boost/python/module.hpp>
#include "test_class.hpp"
#include <boost/python/def.hpp>
#include <boost/python/args.hpp>
#include <boost/python/tuple.hpp>
@@ -11,7 +12,6 @@
#include <boost/python/overloads.hpp>
#include <boost/python/raw_function.hpp>
#include <boost/python/return_internal_reference.hpp>
#include "test_class.hpp"
using namespace boost::python;

View File

@@ -5,6 +5,7 @@
// to its suitability for any purpose.
#include <boost/python/module.hpp>
#include "test_class.hpp"
#include <boost/python/class.hpp>
#include <boost/python/extract.hpp>
#include <boost/python/def.hpp>
@@ -12,7 +13,6 @@
#include <boost/detail/workaround.hpp>
#include "test_class.hpp"
#include <memory>
using namespace boost::python;

View File

@@ -93,6 +93,8 @@ BOOST_PYTHON_MODULE(keywords)
.def("set", &Foo::set, (arg("a") = 0, arg("b") = 0.0, arg("n") = std::string()) )
.def("set2", &Foo::set, (arg("a"), "b", "n") )
.def("a", &Foo::geta)
.def("b", &Foo::getb)
.def("n", &Foo::getn)

View File

@@ -48,6 +48,9 @@
>>> f.set(1,n="1")
>>> f.a(), f.b(), f.n()
(1, 0.0, '1')
>>> f.set2(b=2.0,n="2",a=2)
>>> f.a(), f.b(), f.n()
(2, 2.0, '2')
# lets see how badly we've broken the 'regular' functions
>>> f = Bar()

View File

@@ -134,6 +134,9 @@ bool check_string_slice()
if (s.slice(-3,_) != "rld")
return false;
if (s.slice(_,_) != s)
return false;
if (", " != s.slice(5,7))
return false;

View File

@@ -2,6 +2,26 @@
using namespace boost::python;
namespace test {
// Hmm. return_internal_reference<>() wants to wrap a real class.
class ret_type
{
public:
ret_type() : i(42.5) {}
double i;
};
class crash_me
{
private:
ret_type i;
public:
ret_type& get_i() { return i; }
};
}
struct X
{
X( int value ) : m_value( value )
@@ -55,6 +75,20 @@ BOOST_PYTHON_MODULE(properties_ext)
make_setter( &X::s_count, return_by_internal_reference_t() ) )
//defining class property using a global function
.add_static_property( "instance_count_injected", &get_X_instance_count );
class_< test::ret_type>( "ret_type")
.add_property( "i", &test::ret_type::i, &test::ret_type::i)
;
class_< test::crash_me> crash_me_wrapper( "crash_me");
crash_me_wrapper
.def( "get_i", &test::crash_me::get_i , return_internal_reference<>())
;
crash_me_wrapper.add_property( "i", crash_me_wrapper.attr("get_i"));
}
#include "module_tail.cpp"

View File

@@ -1,5 +1,13 @@
"""
This is test module for properies.
This is test module for properties.
>>> r = properties.ret_type()
>>> r.i = 22.5
>>> r.i
22.5
>>> c = properties.crash_me()
>>> c.i.i
42.5
>>> X = properties.X

143
todo.html
View File

@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.0: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.3.1: http://docutils.sourceforge.net/" />
<title>Boost.Python TODO list Boost</title>
<link rel="stylesheet" href="../../rst.css" type="text/css" />
</head>
@@ -15,8 +15,10 @@
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">copyright:</th><td class="field-body">Copyright David Abrahams 2003. See accompanying
<a class="reference" href="../../LICENSE_1_0.txt">license</a> for terms of use.</td>
<tr class="field"><th class="field-name">copyright:</th><td class="field-body">Copyright David Abrahams 2003. Use, modification, and
distribution are subject to the Boost Software License, Version
1.0. (See accompanying file <a class="reference" href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at
<a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</td>
</tr>
</tbody>
</table>
@@ -27,30 +29,36 @@
<li><a class="reference" href="#base-class-for-virtual-function-callback-wrappers" id="id5" name="id5">Base Class for Virtual Function Callback Wrappers</a></li>
</ul>
</li>
<li><a class="reference" href="#functions" id="id6" name="id6">Functions</a><ul>
<li><a class="reference" href="#wrapping-function-objects" id="id7" name="id7">Wrapping Function Objects</a></li>
<li><a class="reference" href="#best-match-overload-resolution" id="id8" name="id8">&quot;Best Match&quot; Overload Resolution</a></li>
<li><a class="reference" href="#injected-constructors" id="id9" name="id9">Injected Constructors</a></li>
<li><a class="reference" href="#miscellaneous" id="id6" name="id6">Miscellaneous</a><ul>
<li><a class="reference" href="#support-for-enums-with-duplicate-values" id="id7" name="id7">Support for Enums with Duplicate Values</a></li>
</ul>
</li>
<li><a class="reference" href="#type-converters" id="id10" name="id10">Type Converters</a><ul>
<li><a class="reference" href="#lvalue-conversions-from-non-const-pytypeobject-s" id="id11" name="id11">Lvalue conversions from non-const <tt class="literal"><span class="pre">PyTypeObject*</span></tt>s</a></li>
<li><a class="reference" href="#converter-scoping" id="id12" name="id12">Converter Scoping</a></li>
<li><a class="reference" href="#file-conversions" id="id13" name="id13"><tt class="literal"><span class="pre">FILE*</span> <span class="pre">conversions</span></tt></a></li>
<li><a class="reference" href="#post-call-actions" id="id14" name="id14">Post-Call Actions</a></li>
<li><a class="reference" href="#pyunicode-support" id="id15" name="id15"><tt class="literal"><span class="pre">PyUnicode</span></tt> Support</a></li>
<li><a class="reference" href="#functions" id="id8" name="id8">Functions</a><ul>
<li><a class="reference" href="#wrapping-function-objects" id="id9" name="id9">Wrapping Function Objects</a></li>
<li><a class="reference" href="#best-match-overload-resolution" id="id10" name="id10">&quot;Best Match&quot; Overload Resolution</a></li>
</ul>
</li>
<li><a class="reference" href="#documentation" id="id16" name="id16">Documentation</a><ul>
<li><a class="reference" href="#builtin-converters" id="id17" name="id17">Builtin Converters</a></li>
<li><a class="reference" href="#internals" id="id18" name="id18">Internals</a></li>
<li><a class="reference" href="#type-converters" id="id11" name="id11">Type Converters</a><ul>
<li><a class="reference" href="#lvalue-conversions-from-non-const-pytypeobject-s" id="id12" name="id12">Lvalue conversions from non-const <tt class="literal"><span class="pre">PyTypeObject*</span></tt>s</a></li>
<li><a class="reference" href="#converter-scoping" id="id13" name="id13">Converter Scoping</a></li>
<li><a class="reference" href="#file-conversions" id="id14" name="id14"><tt class="literal"><span class="pre">FILE*</span></tt> conversions</a></li>
<li><a class="reference" href="#void-conversions" id="id15" name="id15"><tt class="literal"><span class="pre">void*</span></tt> conversions</a></li>
<li><a class="reference" href="#post-call-actions" id="id16" name="id16">Post-Call Actions</a></li>
<li><a class="reference" href="#pyunicode-support" id="id17" name="id17"><tt class="literal"><span class="pre">PyUnicode</span></tt> Support</a></li>
<li><a class="reference" href="#ownership-metadata" id="id18" name="id18">Ownership Metadata</a></li>
</ul>
</li>
<li><a class="reference" href="#large-scale" id="id19" name="id19">Large Scale</a><ul>
<li><a class="reference" href="#langbinding" id="id20" name="id20">Langbinding</a></li>
<li><a class="reference" href="#refactoring-and-reorganization" id="id21" name="id21">Refactoring and Reorganization</a></li>
<li><a class="reference" href="#numarray-support-enhancements" id="id22" name="id22">NumArray Support Enhancements</a></li>
<li><a class="reference" href="#pyfinalize-safety" id="id23" name="id23"><tt class="literal"><span class="pre">PyFinalize</span></tt> Safety</a></li>
<li><a class="reference" href="#documentation" id="id19" name="id19">Documentation</a><ul>
<li><a class="reference" href="#builtin-converters" id="id20" name="id20">Builtin Converters</a></li>
<li><a class="reference" href="#internals" id="id21" name="id21">Internals</a></li>
</ul>
</li>
<li><a class="reference" href="#large-scale" id="id22" name="id22">Large Scale</a><ul>
<li><a class="reference" href="#full-threading-support" id="id23" name="id23">Full Threading Support</a></li>
<li><a class="reference" href="#langbinding" id="id24" name="id24">Langbinding</a></li>
<li><a class="reference" href="#refactoring-and-reorganization" id="id25" name="id25">Refactoring and Reorganization</a></li>
<li><a class="reference" href="#numarray-support-enhancements" id="id26" name="id26">NumArray Support Enhancements</a></li>
<li><a class="reference" href="#pyfinalize-safety" id="id27" name="id27"><tt class="literal"><span class="pre">PyFinalize</span></tt> Safety</a></li>
</ul>
</li>
</ul>
@@ -65,13 +73,27 @@
<li><a class="reference" href="http://mail.python.org/pipermail/c++-sig/2003-August/005297.html">http://mail.python.org/pipermail/c++-sig/2003-August/005297.html</a>
(search for <tt class="literal"><span class="pre">VirtualDispatcher</span></tt>) describes how callback classes
can swap ownership relationship with their Python wrappers.</li>
<li><a class="reference" href="http://aspn.activestate.com/ASPN/Mail/Message/c++-sig/1860301">http://aspn.activestate.com/ASPN/Mail/Message/c++-sig/1860301</a>
describes how this can also be used to considerably simplify
callback classes, solve some &quot;dangling reference&quot; problems, and
optimize the calling of non-overridden virtual functions.</li>
</ul>
</div>
</div>
<div class="section" id="miscellaneous">
<h1><a class="toc-backref" href="#id6" name="miscellaneous">Miscellaneous</a></h1>
<div class="section" id="support-for-enums-with-duplicate-values">
<h2><a class="toc-backref" href="#id7" name="support-for-enums-with-duplicate-values">Support for Enums with Duplicate Values</a></h2>
<blockquote>
Scott Snyder provided a patch; Dave was dissatisfied for some
reason, but maybe it should just be applied if no further action
occurs <a class="reference" href="http://aspn.activestate.com/ASPN/Mail/Message/1824616">http://aspn.activestate.com/ASPN/Mail/Message/1824616</a>.</blockquote>
</div>
</div>
<div class="section" id="functions">
<h1><a class="toc-backref" href="#id6" name="functions">Functions</a></h1>
<h1><a class="toc-backref" href="#id8" name="functions">Functions</a></h1>
<div class="section" id="wrapping-function-objects">
<h2><a class="toc-backref" href="#id7" name="wrapping-function-objects">Wrapping Function Objects</a></h2>
<h2><a class="toc-backref" href="#id9" name="wrapping-function-objects">Wrapping Function Objects</a></h2>
<blockquote>
<p>It should be possible to wrap classes which support <tt class="literal"><span class="pre">operator()</span></tt>
as Python methods.</p>
@@ -79,7 +101,7 @@ as Python methods.</p>
</blockquote>
</div>
<div class="section" id="best-match-overload-resolution">
<h2><a class="toc-backref" href="#id8" name="best-match-overload-resolution">&quot;Best Match&quot; Overload Resolution</a></h2>
<h2><a class="toc-backref" href="#id10" name="best-match-overload-resolution">&quot;Best Match&quot; Overload Resolution</a></h2>
<blockquote>
<p>Overload resolution currently depends on the order in which <tt class="literal"><span class="pre">def</span></tt>
calls are made (preferring later overloads). This should be
@@ -88,29 +110,16 @@ This may await <a class="reference" href="#langbinding">Langbinding</a> integrat
already in <a class="reference" href="http://luabind.sf.net">Luabind</a>.</p>
</blockquote>
</div>
<div class="section" id="injected-constructors">
<h2><a class="toc-backref" href="#id9" name="injected-constructors">Injected Constructors</a></h2>
<blockquote>
<p>Enabling the addition of new constructor functors or factory
constructors which aren't in the underlying C++ interface.
Interface still to be decided. Here is a discussion of it:</p>
<blockquote>
<a class="reference" href="http://aspn.activestate.com/ASPN/Mail/Message/1744280">http://aspn.activestate.com/ASPN/Mail/Message/1744280</a></blockquote>
<p>However, I'm pretty sure we can't use the init&lt;&gt;(f) interface here
because it will have to instantiate the code for the wrapped
class' default constructor, which may not exist.</p>
</blockquote>
</div>
</div>
<div class="section" id="type-converters">
<h1><a class="toc-backref" href="#id10" name="type-converters">Type Converters</a></h1>
<h1><a class="toc-backref" href="#id11" name="type-converters">Type Converters</a></h1>
<div class="section" id="lvalue-conversions-from-non-const-pytypeobject-s">
<h2><a class="toc-backref" href="#id11" name="lvalue-conversions-from-non-const-pytypeobject-s">Lvalue conversions from non-const <tt class="literal"><span class="pre">PyTypeObject*</span></tt>s</a></h2>
<h2><a class="toc-backref" href="#id12" name="lvalue-conversions-from-non-const-pytypeobject-s">Lvalue conversions from non-const <tt class="literal"><span class="pre">PyTypeObject*</span></tt>s</a></h2>
<blockquote>
<a class="reference" href="http://aspn.activestate.com/ASPN/Mail/Message/C++-sig/1662717">http://aspn.activestate.com/ASPN/Mail/Message/C++-sig/1662717</a></blockquote>
</div>
<div class="section" id="converter-scoping">
<h2><a class="toc-backref" href="#id12" name="converter-scoping">Converter Scoping</a></h2>
<h2><a class="toc-backref" href="#id13" name="converter-scoping">Converter Scoping</a></h2>
<blockquote>
<p><a class="reference" href="http://article.gmane.org/gmane.comp.python.c++/2044">http://article.gmane.org/gmane.comp.python.c++/2044</a></p>
<p>If this gets done at all, it is going to happen in conjunction
@@ -118,12 +127,18 @@ with <a class="reference" href="#langbinding">Luabind integration</a>.</p>
</blockquote>
</div>
<div class="section" id="file-conversions">
<h2><a class="toc-backref" href="#id13" name="file-conversions"><tt class="literal"><span class="pre">FILE*</span> <span class="pre">conversions</span></tt></a></h2>
<h2><a class="toc-backref" href="#id14" name="file-conversions"><tt class="literal"><span class="pre">FILE*</span></tt> conversions</a></h2>
<blockquote>
<a class="reference" href="http://aspn.activestate.com/ASPN/Mail/Message/1411366">http://aspn.activestate.com/ASPN/Mail/Message/1411366</a></blockquote>
</div>
<div class="section" id="void-conversions">
<h2><a class="toc-backref" href="#id15" name="void-conversions"><tt class="literal"><span class="pre">void*</span></tt> conversions</a></h2>
<blockquote>
Pointers to <em>cv</em> <tt class="literal"><span class="pre">void</span></tt> should be able to be passed and
returned as opaque values.</blockquote>
</div>
<div class="section" id="post-call-actions">
<h2><a class="toc-backref" href="#id14" name="post-call-actions">Post-Call Actions</a></h2>
<h2><a class="toc-backref" href="#id16" name="post-call-actions">Post-Call Actions</a></h2>
<blockquote>
From-Python converters should be passed an extra reference to a
chain of post-call actions in the Policies object, where they can
@@ -131,23 +146,34 @@ register an additional action. See the end of
<a class="reference" href="http://aspn.activestate.com/ASPN/Mail/Message/C++-sig/1755435">http://aspn.activestate.com/ASPN/Mail/Message/C++-sig/1755435</a></blockquote>
</div>
<div class="section" id="pyunicode-support">
<h2><a class="toc-backref" href="#id15" name="pyunicode-support"><tt class="literal"><span class="pre">PyUnicode</span></tt> Support</a></h2>
<h2><a class="toc-backref" href="#id17" name="pyunicode-support"><tt class="literal"><span class="pre">PyUnicode</span></tt> Support</a></h2>
<blockquote>
<p>Review and possibly incorporate changes from <a class="reference" href="mailto:qinlj-at-solidshare.com">Lijun Qin</a> at
<a class="reference" href="http://aspn.activestate.com/ASPN/Mail/Message/C++-sig/1771145">http://aspn.activestate.com/ASPN/Mail/Message/C++-sig/1771145</a></p>
</blockquote>
</div>
<div class="section" id="ownership-metadata">
<h2><a class="toc-backref" href="#id18" name="ownership-metadata">Ownership Metadata</a></h2>
<blockquote>
In the thread at
<a class="reference" href="http://aspn.activestate.com/ASPN/Mail/Message/c++-sig/1860301">http://aspn.activestate.com/ASPN/Mail/Message/c++-sig/1860301</a>,
Niall Douglas describes an idea for solving some &quot;false&quot;
dangling pointer/reference return errors by attaching data about
objects which lets the framework determine that the reference
count on an object doesn't tell us anything about the lifetime
of its data.</blockquote>
</div>
</div>
<div class="section" id="documentation">
<h1><a class="toc-backref" href="#id16" name="documentation">Documentation</a></h1>
<h1><a class="toc-backref" href="#id19" name="documentation">Documentation</a></h1>
<div class="section" id="builtin-converters">
<h2><a class="toc-backref" href="#id17" name="builtin-converters">Builtin Converters</a></h2>
<h2><a class="toc-backref" href="#id20" name="builtin-converters">Builtin Converters</a></h2>
<blockquote>
Builtin correspondences between builtiin Python types and C++
types need to be documented</blockquote>
</div>
<div class="section" id="internals">
<h2><a class="toc-backref" href="#id18" name="internals">Internals</a></h2>
<h2><a class="toc-backref" href="#id21" name="internals">Internals</a></h2>
<blockquote>
<p>The structure of the framework needs to get documented; <a class="reference" href="mailto:brett.calcott-at-paradise.net.nz">Brett
Calcott</a> has promised to turn <a class="reference" href="doc/internals.html">this document</a> into something fit
@@ -156,27 +182,38 @@ for users</p>
</div>
</div>
<div class="section" id="large-scale">
<h1><a class="toc-backref" href="#id19" name="large-scale">Large Scale</a></h1>
<h1><a class="toc-backref" href="#id22" name="large-scale">Large Scale</a></h1>
<div class="section" id="full-threading-support">
<h2><a class="toc-backref" href="#id23" name="full-threading-support">Full Threading Support</a></h2>
<blockquote>
Various people have proposed patches to improve threading support
in Boost.Python: see the thread at
<a class="reference" href="http://aspn.activestate.com/ASPN/Mail/Message/1826544">http://aspn.activestate.com/ASPN/Mail/Message/1826544</a> and
<a class="reference" href="http://aspn.activestate.com/ASPN/Mail/Message/1865842">http://aspn.activestate.com/ASPN/Mail/Message/1865842</a> for some
examples. The only problem is that these are incomplete
solutions and verifying that we <em>do</em> have a complete solution is
going to take some time and attention.</blockquote>
</div>
<div class="section" id="langbinding">
<h2><a class="toc-backref" href="#id20" name="langbinding">Langbinding</a></h2>
<h2><a class="toc-backref" href="#id24" name="langbinding">Langbinding</a></h2>
<blockquote>
This project to generalizes Boost.Python to work for other
languages, initially Lua. See discussions at
<a class="reference" href="http://lists.sourceforge.net/lists/listinfo/boost-langbinding">http://lists.sourceforge.net/lists/listinfo/boost-langbinding</a></blockquote>
</div>
<div class="section" id="refactoring-and-reorganization">
<h2><a class="toc-backref" href="#id21" name="refactoring-and-reorganization">Refactoring and Reorganization</a></h2>
<h2><a class="toc-backref" href="#id25" name="refactoring-and-reorganization">Refactoring and Reorganization</a></h2>
<blockquote>
<a class="reference" href="http://aspn.activestate.com/ASPN/Mail/Message/c++-sig/1673338">http://aspn.activestate.com/ASPN/Mail/Message/c++-sig/1673338</a></blockquote>
</div>
<div class="section" id="numarray-support-enhancements">
<h2><a class="toc-backref" href="#id22" name="numarray-support-enhancements">NumArray Support Enhancements</a></h2>
<h2><a class="toc-backref" href="#id26" name="numarray-support-enhancements">NumArray Support Enhancements</a></h2>
<blockquote>
Consider integrating the enhancements described in
<a class="reference" href="http://aspn.activestate.com/ASPN/Mail/Message/C++-sig/1757092">http://aspn.activestate.com/ASPN/Mail/Message/C++-sig/1757092</a></blockquote>
</div>
<div class="section" id="pyfinalize-safety">
<h2><a class="toc-backref" href="#id23" name="pyfinalize-safety"><tt class="literal"><span class="pre">PyFinalize</span></tt> Safety</a></h2>
<h2><a class="toc-backref" href="#id27" name="pyfinalize-safety"><tt class="literal"><span class="pre">PyFinalize</span></tt> Safety</a></h2>
<blockquote>
<p>Currently Boost.Python has several global (or function-static)
objects whose existence keeps reference counts from dropping to
@@ -191,10 +228,10 @@ interpreter. <a class="reference" href="mailto:dirk-at-gerrits.homeip.net">Dirk
</div>
</div>
</div>
<hr class="footer"/>
<hr class="footer" />
<div class="footer">
<a class="reference" href="todo.txt">View document source</a>.
Generated on: 2003-09-11 11:04 UTC.
Generated on: 2004-01-02 18:33 UTC.
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
</body>

View File

@@ -11,12 +11,14 @@ __ ../../index.htm
.. _`Boost.Python`: index.html
:copyright: Copyright David Abrahams 2003. See accompanying
license_ for terms of use.
:copyright: Copyright David Abrahams 2003. Use, modification, and
distribution are subject to the Boost Software License, Version
1.0. (See accompanying file `LICENSE_1_0.txt`_ or copy at
http://www.boost.org/LICENSE_1_0.txt)
.. contents:: Outline
.. _license: ../../LICENSE_1_0.txt
.. _`LICENSE_1_0.txt`: ../../LICENSE_1_0.txt
Class Support
=============
@@ -31,6 +33,20 @@ Base Class for Virtual Function Callback Wrappers
(search for ``VirtualDispatcher``) describes how callback classes
can swap ownership relationship with their Python wrappers.
* http://aspn.activestate.com/ASPN/Mail/Message/c++-sig/1860301
describes how this can also be used to considerably simplify
callback classes, solve some "dangling reference" problems, and
optimize the calling of non-overridden virtual functions.
Miscellaneous
=============
Support for Enums with Duplicate Values
---------------------------------------
Scott Snyder provided a patch; Dave was dissatisfied for some
reason, but maybe it should just be applied if no further action
occurs http://aspn.activestate.com/ASPN/Mail/Message/1824616.
Functions
@@ -56,21 +72,6 @@ Wrapping Function Objects
.. _Luabind: http://luabind.sf.net
Injected Constructors
---------------------
Enabling the addition of new constructor functors or factory
constructors which aren't in the underlying C++ interface.
Interface still to be decided. Here is a discussion of it:
http://aspn.activestate.com/ASPN/Mail/Message/1744280
However, I'm pretty sure we can't use the init<>(f) interface here
because it will have to instantiate the code for the wrapped
class' default constructor, which may not exist.
Type Converters
===============
@@ -89,11 +90,17 @@ Converter Scoping
__ Langbinding_
``FILE* conversions``
``FILE*`` conversions
---------------------
http://aspn.activestate.com/ASPN/Mail/Message/1411366
``void*`` conversions
---------------------
Pointers to *cv* ``void`` should be able to be passed and
returned as opaque values.
Post-Call Actions
-----------------
@@ -110,6 +117,17 @@ Post-Call Actions
.. _`Lijun Qin`: mailto:qinlj-at-solidshare.com
Ownership Metadata
------------------
In the thread at
http://aspn.activestate.com/ASPN/Mail/Message/c++-sig/1860301,
Niall Douglas describes an idea for solving some "false"
dangling pointer/reference return errors by attaching data about
objects which lets the framework determine that the reference
count on an object doesn't tell us anything about the lifetime
of its data.
Documentation
=============
@@ -134,6 +152,17 @@ Internals
Large Scale
===========
Full Threading Support
----------------------
Various people have proposed patches to improve threading support
in Boost.Python: see the thread at
http://aspn.activestate.com/ASPN/Mail/Message/1826544 and
http://aspn.activestate.com/ASPN/Mail/Message/1865842 for some
examples. The only problem is that these are incomplete
solutions and verifying that we *do* have a complete solution is
going to take some time and attention.
Langbinding
-----------