mirror of
https://github.com/boostorg/python.git
synced 2026-01-27 19:12:16 +00:00
Merge branch 'develop'
This commit is contained in:
@@ -1417,6 +1417,8 @@ eval evaluates the given expression and returns the resulting value.
|
||||
exec executes the given code (typically a set of statements) returning the result,
|
||||
and exec_file executes the code contained in the given file.
|
||||
|
||||
There are also overloads taking `char const*` instead of str as the first argument.
|
||||
|
||||
The [^globals] and [^locals] parameters are Python dictionaries
|
||||
containing the globals and locals of the context in which to run the code.
|
||||
For most intents and purposes you can use the namespace dictionary of the
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# include <boost/python/converter/arg_from_python.hpp>
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \
|
||||
|| BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(800))
|
||||
# include <boost/type_traits/remove_cv.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace python {
|
||||
@@ -19,7 +19,7 @@ struct arg_from_python
|
||||
: converter::select_arg_from_python<
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \
|
||||
|| BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(800))
|
||||
typename boost::remove_cv<T>::type
|
||||
typename detail::remove_cv<T>::type
|
||||
# else
|
||||
T
|
||||
# endif
|
||||
@@ -28,7 +28,7 @@ struct arg_from_python
|
||||
typedef typename converter::select_arg_from_python<
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \
|
||||
|| BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(800))
|
||||
typename boost::remove_cv<T>::type
|
||||
typename detail::remove_cv<T>::type
|
||||
# else
|
||||
T
|
||||
# endif
|
||||
|
||||
@@ -11,10 +11,7 @@
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/python/detail/preprocessor.hpp>
|
||||
# include <boost/python/detail/type_list.hpp>
|
||||
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
# include <boost/type_traits/remove_reference.hpp>
|
||||
# include <boost/type_traits/remove_cv.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
# include <boost/preprocessor/enum_params.hpp>
|
||||
# include <boost/preprocessor/repeat.hpp>
|
||||
@@ -116,9 +113,9 @@ namespace detail
|
||||
template <class T>
|
||||
struct is_reference_to_keywords
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, is_ref = is_reference<T>::value);
|
||||
typedef typename remove_reference<T>::type deref;
|
||||
typedef typename remove_cv<deref>::type key_t;
|
||||
BOOST_STATIC_CONSTANT(bool, is_ref = detail::is_reference<T>::value);
|
||||
typedef typename detail::remove_reference<T>::type deref;
|
||||
typedef typename detail::remove_cv<deref>::type key_t;
|
||||
BOOST_STATIC_CONSTANT(bool, is_key = is_keywords<key_t>::value);
|
||||
BOOST_STATIC_CONSTANT(bool, value = (is_ref & is_key));
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
# define BASES_DWA2002321_HPP
|
||||
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/python/detail/type_list.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
# include <boost/preprocessor/enum_params_with_a_default.hpp>
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
# define CAST_DWA200269_HPP
|
||||
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
# include <boost/type_traits/same_traits.hpp>
|
||||
# include <boost/type_traits/cv_traits.hpp>
|
||||
# include <boost/type.hpp>
|
||||
# include <boost/python/base_type_traits.hpp>
|
||||
# include <boost/python/detail/convertible.hpp>
|
||||
@@ -76,9 +75,9 @@ namespace detail
|
||||
template <class Source, class Target>
|
||||
inline Target* upcast_impl(Source* x, Target*)
|
||||
{
|
||||
typedef typename add_cv<Source>::type src_t;
|
||||
typedef typename add_cv<Target>::type target_t;
|
||||
bool const same = is_same<src_t,target_t>::value;
|
||||
typedef typename detail::add_cv<Source>::type src_t;
|
||||
typedef typename detail::add_cv<Target>::type target_t;
|
||||
bool const same = detail::is_same<src_t,target_t>::value;
|
||||
|
||||
return detail::upcaster<same>::execute(x, (Target*)0);
|
||||
}
|
||||
|
||||
@@ -28,13 +28,10 @@
|
||||
# include <boost/python/detail/operator_id.hpp>
|
||||
# include <boost/python/detail/def_helper.hpp>
|
||||
# include <boost/python/detail/force_instantiate.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/python/detail/unwrap_type_id.hpp>
|
||||
# include <boost/python/detail/unwrap_wrapper.hpp>
|
||||
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
# include <boost/type_traits/is_member_function_pointer.hpp>
|
||||
# include <boost/type_traits/is_polymorphic.hpp>
|
||||
|
||||
# include <boost/mpl/size.hpp>
|
||||
# include <boost/mpl/for_each.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
@@ -53,7 +50,6 @@
|
||||
|
||||
# ifdef BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING
|
||||
# include <boost/mpl/and.hpp>
|
||||
# include <boost/type_traits/is_member_pointer.hpp>
|
||||
# endif
|
||||
|
||||
namespace boost { namespace python {
|
||||
@@ -84,8 +80,8 @@ namespace detail
|
||||
template <class T>
|
||||
struct is_data_member_pointer
|
||||
: mpl::and_<
|
||||
is_member_pointer<T>
|
||||
, mpl::not_<is_member_function_pointer<T> >
|
||||
detail::is_member_pointer<T>
|
||||
, mpl::not_<detail::is_member_function_pointer<T> >
|
||||
>
|
||||
{};
|
||||
|
||||
@@ -138,11 +134,11 @@ namespace detail
|
||||
must_be_derived_class_member(Default const&)
|
||||
{
|
||||
// https://svn.boost.org/trac/boost/ticket/5803
|
||||
//typedef typename assertion<mpl::not_<is_same<Default,Fn> > >::failed test0;
|
||||
//typedef typename assertion<mpl::not_<detail::is_same<Default,Fn> > >::failed test0;
|
||||
# if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
||||
typedef typename assertion<is_polymorphic<T> >::failed test1 BOOST_ATTRIBUTE_UNUSED;
|
||||
typedef typename assertion<detail::is_polymorphic<T> >::failed test1 BOOST_ATTRIBUTE_UNUSED;
|
||||
# endif
|
||||
typedef typename assertion<is_member_function_pointer<Fn> >::failed test2 BOOST_ATTRIBUTE_UNUSED;
|
||||
typedef typename assertion<detail::is_member_function_pointer<Fn> >::failed test2 BOOST_ATTRIBUTE_UNUSED;
|
||||
not_a_derived_class_member<Default>(Fn());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
# include <boost/python/converter/from_python.hpp>
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
# include <boost/type_traits/transform_traits.hpp>
|
||||
# include <boost/type_traits/cv_traits.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/python/converter/rvalue_from_python_data.hpp>
|
||||
# include <boost/mpl/eval_if.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
@@ -106,7 +105,7 @@ struct reference_arg_from_python : arg_lvalue_from_python_base
|
||||
template <class T>
|
||||
struct arg_rvalue_from_python
|
||||
{
|
||||
typedef typename boost::add_reference<
|
||||
typedef typename boost::python::detail::add_lvalue_reference<
|
||||
T
|
||||
// We can't add_const here, or it would be impossible to pass
|
||||
// auto_ptr<U> args from Python to C++
|
||||
|
||||
@@ -24,11 +24,7 @@
|
||||
# include <boost/python/detail/convertible.hpp>
|
||||
# include <boost/python/detail/string_literal.hpp>
|
||||
# include <boost/python/detail/value_is_shared_ptr.hpp>
|
||||
|
||||
# include <boost/type_traits/cv_traits.hpp>
|
||||
# include <boost/type_traits/composite_traits.hpp>
|
||||
# include <boost/type_traits/function_traits.hpp>
|
||||
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
# include <boost/mpl/or.hpp>
|
||||
|
||||
@@ -116,9 +112,9 @@ namespace detail
|
||||
|
||||
, typename mpl::if_<
|
||||
mpl::or_<
|
||||
is_function<T>
|
||||
boost::python::detail::is_function<T>
|
||||
, indirect_traits::is_pointer_to_function<T>
|
||||
, is_member_function_pointer<T>
|
||||
, boost::python::detail::is_member_function_pointer<T>
|
||||
>
|
||||
, function_arg_to_python<T>
|
||||
|
||||
@@ -127,7 +123,7 @@ namespace detail
|
||||
, object_manager_arg_to_python<T>
|
||||
|
||||
, typename mpl::if_<
|
||||
is_pointer<T>
|
||||
boost::python::detail::is_pointer<T>
|
||||
, pointer_deep_arg_to_python<T>
|
||||
|
||||
, typename mpl::if_<
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# include <boost/python/handle.hpp>
|
||||
# include <boost/python/cast.hpp>
|
||||
# include <boost/python/converter/pyobject_traits.hpp>
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# define POINTER_TYPE_ID_DWA2002222_HPP
|
||||
|
||||
# include <boost/python/type_id.hpp>
|
||||
# include <boost/type_traits/composite_traits.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace converter {
|
||||
|
||||
@@ -59,7 +59,7 @@ template <class T>
|
||||
type_info pointer_type_id(T(*)() = 0)
|
||||
{
|
||||
return detail::pointer_typeid_select<
|
||||
is_reference<T>::value
|
||||
boost::python::detail::is_lvalue_reference<T>::value
|
||||
>::execute((T(*)())0);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
# include <boost/python/converter/registered.hpp>
|
||||
# include <boost/python/detail/unwind_type.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace python {
|
||||
@@ -53,7 +54,7 @@ inline python::type_info unwind_type_id_(boost::type<void>* = 0, mpl::true_* =0)
|
||||
template <class T>
|
||||
inline python::type_info unwind_type_id(boost::type<T>* p= 0)
|
||||
{
|
||||
return unwind_type_id_(p, (mpl::bool_<boost::is_void<T>::value >*)0 );
|
||||
return unwind_type_id_(p, (mpl::bool_<boost::python::detail::is_void<T>::value >*)0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +65,7 @@ struct expected_pytype_for_arg
|
||||
static PyTypeObject const *get_pytype()
|
||||
{
|
||||
const converter::registration *r=converter::registry::query(
|
||||
detail::unwind_type_id_((boost::type<T>*)0, (mpl::bool_<boost::is_void<T>::value >*)0 )
|
||||
detail::unwind_type_id_((boost::type<T>*)0, (mpl::bool_<boost::python::detail::is_void<T>::value >*)0 )
|
||||
);
|
||||
return r ? r->expected_from_python_type(): 0;
|
||||
}
|
||||
@@ -77,7 +78,7 @@ struct registered_pytype
|
||||
static PyTypeObject const *get_pytype()
|
||||
{
|
||||
const converter::registration *r=converter::registry::query(
|
||||
detail::unwind_type_id_((boost::type<T>*) 0, (mpl::bool_<boost::is_void<T>::value >*)0 )
|
||||
detail::unwind_type_id_((boost::type<T>*) 0, (mpl::bool_<boost::python::detail::is_void<T>::value >*)0 )
|
||||
);
|
||||
return r ? r->m_class_object: 0;
|
||||
}
|
||||
@@ -111,7 +112,7 @@ struct to_python_target_type
|
||||
static PyTypeObject const *get_pytype()
|
||||
{
|
||||
const converter::registration *r=converter::registry::query(
|
||||
detail::unwind_type_id_((boost::type<T>*)0, (mpl::bool_<boost::is_void<T>::value >*)0 )
|
||||
detail::unwind_type_id_((boost::type<T>*)0, (mpl::bool_<boost::python::detail::is_void<T>::value >*)0 )
|
||||
);
|
||||
return r ? r->to_python_target_type(): 0;
|
||||
}
|
||||
|
||||
@@ -10,9 +10,7 @@
|
||||
#include <boost/python/type_id.hpp>
|
||||
#include <boost/python/converter/registry.hpp>
|
||||
#include <boost/python/converter/registrations.hpp>
|
||||
#include <boost/type_traits/transform_traits.hpp>
|
||||
#include <boost/type_traits/cv_traits.hpp>
|
||||
#include <boost/type_traits/is_void.hpp>
|
||||
#include <boost/python/detail/type_traits.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/type.hpp>
|
||||
#include <memory>
|
||||
@@ -44,8 +42,8 @@ namespace detail
|
||||
template <class T>
|
||||
struct registered
|
||||
: detail::registered_base<
|
||||
typename add_reference<
|
||||
typename add_cv<T>::type
|
||||
typename boost::python::detail::add_lvalue_reference<
|
||||
typename boost::python::detail::add_cv<T>::type
|
||||
>::type
|
||||
>
|
||||
{
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
# include <boost/python/converter/registered.hpp>
|
||||
# include <boost/python/converter/pointer_type_id.hpp>
|
||||
# include <boost/python/converter/registry.hpp>
|
||||
# include <boost/type_traits/transform_traits.hpp>
|
||||
# include <boost/type_traits/cv_traits.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace converter {
|
||||
|
||||
@@ -17,9 +16,9 @@ struct registration;
|
||||
template <class T>
|
||||
struct registered_pointee
|
||||
: registered<
|
||||
typename remove_pointer<
|
||||
typename remove_cv<
|
||||
typename remove_reference<T>::type
|
||||
typename boost::python::detail::remove_pointer<
|
||||
typename boost::python::detail::remove_cv<
|
||||
typename boost::python::detail::remove_reference<T>::type
|
||||
>::type
|
||||
>::type
|
||||
>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# include <boost/python/detail/void_return.hpp>
|
||||
# include <boost/python/errors.hpp>
|
||||
# include <boost/python/handle.hpp>
|
||||
# include <boost/type_traits/has_trivial_copy.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/mpl/and.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
|
||||
|
||||
@@ -8,9 +8,8 @@
|
||||
# include <boost/python/converter/constructor_function.hpp>
|
||||
# include <boost/python/detail/referent_storage.hpp>
|
||||
# include <boost/python/detail/destroy.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/static_assert.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
# include <boost/type_traits/add_cv.hpp>
|
||||
# include <cstddef>
|
||||
|
||||
// Data management for potential rvalue conversions from Python to C++
|
||||
@@ -78,7 +77,7 @@ struct rvalue_from_python_storage
|
||||
|
||||
// Storage for the result, in case an rvalue must be constructed
|
||||
typename python::detail::referent_storage<
|
||||
typename add_reference<T>::type
|
||||
typename boost::python::detail::add_lvalue_reference<T>::type
|
||||
>::type storage;
|
||||
};
|
||||
|
||||
@@ -110,7 +109,8 @@ struct rvalue_from_python_data : rvalue_from_python_storage<T>
|
||||
// Destroys any object constructed in the storage.
|
||||
~rvalue_from_python_data();
|
||||
private:
|
||||
typedef typename add_reference<typename add_cv<T>::type>::type ref_type;
|
||||
typedef typename boost::python::detail::add_lvalue_reference<
|
||||
typename boost::python::detail::add_cv<T>::type>::type ref_type;
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
@@ -19,14 +19,7 @@
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
# include <boost/python/detail/not_specified.hpp>
|
||||
# include <boost/python/detail/value_arg.hpp>
|
||||
|
||||
# include <boost/type_traits/add_const.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
# include <boost/type_traits/is_member_pointer.hpp>
|
||||
|
||||
# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|
||||
# include <boost/type_traits/remove_cv.hpp>
|
||||
# endif
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
# include <boost/mpl/eval_if.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
@@ -147,20 +140,20 @@ namespace detail
|
||||
// boost::python::make_getter are used to dispatch behavior. The
|
||||
// third argument is a workaround for a CWPro8 partial ordering bug
|
||||
// with pointers to data members. It should be convertible to
|
||||
// mpl::true_ iff the first argument is a pointer-to-member, and
|
||||
// mpl::false_ otherwise. The fourth argument is for compilers
|
||||
// detail::true_ iff the first argument is a pointer-to-member, and
|
||||
// detail::false_ otherwise. The fourth argument is for compilers
|
||||
// which don't support partial ordering at all and should always be
|
||||
// passed 0L.
|
||||
//
|
||||
|
||||
|
||||
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
|
||||
template <class D, class P>
|
||||
inline object make_getter(D& d, P& p, mpl::false_, ...);
|
||||
inline object make_getter(D& d, P& p, detail::false_, ...);
|
||||
#endif
|
||||
|
||||
// Handle non-member pointers with policies
|
||||
template <class D, class Policies>
|
||||
inline object make_getter(D* d, Policies const& policies, mpl::false_, int)
|
||||
inline object make_getter(D* d, Policies const& policies, detail::false_, int)
|
||||
{
|
||||
return python::make_function(
|
||||
detail::datum<D>(d), policies, mpl::vector1<D&>()
|
||||
@@ -169,18 +162,18 @@ namespace detail
|
||||
|
||||
// Handle non-member pointers without policies
|
||||
template <class D>
|
||||
inline object make_getter(D* d, not_specified, mpl::false_, long)
|
||||
inline object make_getter(D* d, not_specified, detail::false_, long)
|
||||
{
|
||||
typedef typename default_datum_getter_policy<D>::type policies;
|
||||
return detail::make_getter(d, policies(), mpl::false_(), 0);
|
||||
return detail::make_getter(d, policies(), detail::false_(), 0);
|
||||
}
|
||||
|
||||
// Handle pointers-to-members with policies
|
||||
template <class C, class D, class Policies>
|
||||
inline object make_getter(D C::*pm, Policies const& policies, mpl::true_, int)
|
||||
inline object make_getter(D C::*pm, Policies const& policies, detail::true_, int)
|
||||
{
|
||||
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|
||||
typedef typename remove_cv<C>::type Class;
|
||||
typedef typename detail::remove_cv<C>::type Class;
|
||||
#else
|
||||
typedef C Class;
|
||||
#endif
|
||||
@@ -193,18 +186,18 @@ namespace detail
|
||||
|
||||
// Handle pointers-to-members without policies
|
||||
template <class C, class D>
|
||||
inline object make_getter(D C::*pm, not_specified, mpl::true_, long)
|
||||
inline object make_getter(D C::*pm, not_specified, detail::true_, long)
|
||||
{
|
||||
typedef typename default_member_getter_policy<D>::type policies;
|
||||
return detail::make_getter(pm, policies(), mpl::true_(), 0);
|
||||
return detail::make_getter(pm, policies(), detail::true_(), 0);
|
||||
}
|
||||
|
||||
// Handle references
|
||||
template <class D, class P>
|
||||
inline object make_getter(D& d, P& p, mpl::false_, ...)
|
||||
inline object make_getter(D& d, P& p, detail::false_, ...)
|
||||
{
|
||||
// Just dispatch to the handler for pointer types.
|
||||
return detail::make_getter(&d, p, mpl::false_(), 0L);
|
||||
return detail::make_getter(&d, p, detail::false_(), 0L);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -217,7 +210,7 @@ namespace detail
|
||||
|
||||
// Handle non-member pointers
|
||||
template <class D, class Policies>
|
||||
inline object make_setter(D* p, Policies const& policies, mpl::false_, int)
|
||||
inline object make_setter(D* p, Policies const& policies, detail::false_, int)
|
||||
{
|
||||
return python::make_function(
|
||||
detail::datum<D>(p), policies, mpl::vector2<void,D const&>()
|
||||
@@ -226,7 +219,7 @@ namespace detail
|
||||
|
||||
// Handle pointers-to-members
|
||||
template <class C, class D, class Policies>
|
||||
inline object make_setter(D C::*pm, Policies const& policies, mpl::true_, int)
|
||||
inline object make_setter(D C::*pm, Policies const& policies, detail::true_, int)
|
||||
{
|
||||
return python::make_function(
|
||||
detail::member<D,C>(pm)
|
||||
@@ -237,9 +230,9 @@ namespace detail
|
||||
|
||||
// Handle references
|
||||
template <class D, class Policies>
|
||||
inline object make_setter(D& x, Policies const& policies, mpl::false_, ...)
|
||||
inline object make_setter(D& x, Policies const& policies, detail::false_, ...)
|
||||
{
|
||||
return detail::make_setter(&x, policies, mpl::false_(), 0L);
|
||||
return detail::make_setter(&x, policies, detail::false_(), 0L);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,13 +246,13 @@ namespace detail
|
||||
template <class D, class Policies>
|
||||
inline object make_getter(D& d, Policies const& policies)
|
||||
{
|
||||
return detail::make_getter(d, policies, is_member_pointer<D>(), 0L);
|
||||
return detail::make_getter(d, policies, detail::is_member_pointer<D>(), 0L);
|
||||
}
|
||||
|
||||
template <class D, class Policies>
|
||||
inline object make_getter(D const& d, Policies const& policies)
|
||||
{
|
||||
return detail::make_getter(d, policies, is_member_pointer<D>(), 0L);
|
||||
return detail::make_getter(d, policies, detail::is_member_pointer<D>(), 0L);
|
||||
}
|
||||
|
||||
template <class D>
|
||||
@@ -267,7 +260,7 @@ inline object make_getter(D& x)
|
||||
{
|
||||
detail::not_specified policy
|
||||
= detail::not_specified(); // suppress a SunPro warning
|
||||
return detail::make_getter(x, policy, is_member_pointer<D>(), 0L);
|
||||
return detail::make_getter(x, policy, detail::is_member_pointer<D>(), 0L);
|
||||
}
|
||||
|
||||
# if !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
|
||||
@@ -276,7 +269,7 @@ inline object make_getter(D const& d)
|
||||
{
|
||||
detail::not_specified policy
|
||||
= detail::not_specified(); // Suppress a SunPro warning
|
||||
return detail::make_getter(d, policy, is_member_pointer<D>(), 0L);
|
||||
return detail::make_getter(d, policy, detail::is_member_pointer<D>(), 0L);
|
||||
}
|
||||
# endif
|
||||
|
||||
@@ -290,26 +283,26 @@ inline object make_getter(D const& d)
|
||||
template <class D, class Policies>
|
||||
inline object make_setter(D& x, Policies const& policies)
|
||||
{
|
||||
return detail::make_setter(x, policies, is_member_pointer<D>(), 0);
|
||||
return detail::make_setter(x, policies, detail::is_member_pointer<D>(), 0);
|
||||
}
|
||||
|
||||
template <class D, class Policies>
|
||||
inline object make_setter(D const& x, Policies const& policies)
|
||||
{
|
||||
return detail::make_setter(x, policies, is_member_pointer<D>(), 0);
|
||||
return detail::make_setter(x, policies, detail::is_member_pointer<D>(), 0);
|
||||
}
|
||||
|
||||
template <class D>
|
||||
inline object make_setter(D& x)
|
||||
{
|
||||
return detail::make_setter(x, default_call_policies(), is_member_pointer<D>(), 0);
|
||||
return detail::make_setter(x, default_call_policies(), detail::is_member_pointer<D>(), 0);
|
||||
}
|
||||
|
||||
# if !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
|
||||
template <class D>
|
||||
inline object make_setter(D const& x)
|
||||
{
|
||||
return detail::make_setter(x, default_call_policies(), is_member_pointer<D>(), 0);
|
||||
return detail::make_setter(x, default_call_policies(), detail::is_member_pointer<D>(), 0);
|
||||
}
|
||||
# endif
|
||||
|
||||
|
||||
@@ -8,10 +8,8 @@
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/python/to_python_value.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/python/detail/value_arg.hpp>
|
||||
# include <boost/type_traits/transform_traits.hpp>
|
||||
# include <boost/type_traits/is_pointer.hpp>
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
# include <boost/mpl/or.hpp>
|
||||
# include <boost/mpl/front.hpp>
|
||||
|
||||
@@ -64,7 +62,7 @@ struct default_result_converter
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
mpl::or_<is_pointer<R>, is_reference<R> >
|
||||
mpl::or_<detail::is_pointer<R>, detail::is_reference<R> >
|
||||
, detail::specify_a_return_value_policy_to_wrap_functions_returning<R>
|
||||
, boost::python::to_python_value<
|
||||
typename detail::value_arg<R>::type
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/type.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/type_traits/cv_traits.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/python/tag.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
# include <boost/python/detail/invoke.hpp>
|
||||
# include <boost/python/detail/signature.hpp>
|
||||
# include <boost/python/detail/preprocessor.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
# include <boost/python/arg_from_python.hpp>
|
||||
# include <boost/python/converter/context_result_converter.hpp>
|
||||
@@ -31,9 +32,6 @@
|
||||
|
||||
# include <boost/compressed_pair.hpp>
|
||||
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
# include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
# include <boost/mpl/apply.hpp>
|
||||
# include <boost/mpl/eval_if.hpp>
|
||||
# include <boost/mpl/identity.hpp>
|
||||
@@ -236,7 +234,7 @@ struct caller_arity<N>
|
||||
typedef typename select_result_converter<Policies, rtype>::type result_converter;
|
||||
|
||||
static const signature_element ret = {
|
||||
(boost::is_void<rtype>::value ? "void" : type_id<rtype>().name())
|
||||
(is_void<rtype>::value ? "void" : type_id<rtype>().name())
|
||||
, &detail::converter_target_type<result_converter>::get_pytype
|
||||
, boost::detail::indirect_traits::is_reference_to_non_const<rtype>::value
|
||||
};
|
||||
|
||||
@@ -105,7 +105,11 @@
|
||||
// Set the name of our library, this will get undef'ed by auto_link.hpp
|
||||
// once it's done with it:
|
||||
//
|
||||
#define BOOST_LIB_NAME boost_python
|
||||
#if PY_MAJOR_VERSION == 2
|
||||
# define BOOST_LIB_NAME boost_python
|
||||
#elif PY_MAJOR_VERSION == 3
|
||||
# define BOOST_LIB_NAME boost_python3
|
||||
#endif
|
||||
//
|
||||
// If we're importing code from a dll, then tell auto_link.hpp about it:
|
||||
//
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
|
||||
# if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 241
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/type_traits/conversion_traits.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# endif
|
||||
|
||||
// Supplies a runtime is_convertible check which can be used with tag
|
||||
// dispatching to work around the Metrowerks Pro7 limitation with boost::is_convertible
|
||||
// dispatching to work around the Metrowerks Pro7 limitation with boost/std::is_convertible
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
typedef char* yes_convertible;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef CV_CATEGORY_DWA200222_HPP
|
||||
# define CV_CATEGORY_DWA200222_HPP
|
||||
# include <boost/type_traits/cv_traits.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
@@ -26,8 +26,8 @@ struct cv_category
|
||||
// BOOST_STATIC_CONSTANT(bool, c = is_const<T>::value);
|
||||
// BOOST_STATIC_CONSTANT(bool, v = is_volatile<T>::value);
|
||||
typedef cv_tag<
|
||||
::boost::is_const<T>::value
|
||||
, ::boost::is_volatile<T>::value
|
||||
is_const<T>::value
|
||||
, is_volatile<T>::value
|
||||
> type;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright Gottfried Ganßauge 2003.
|
||||
// Copyright Gottfried Ganßauge 2003.
|
||||
// Distributed under 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)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
# include <boost/python/type_id.hpp>
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
# include <boost/type_traits/cv_traits.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
|
||||
@@ -6,12 +6,11 @@
|
||||
# define DEF_HELPER_DWA200287_HPP
|
||||
|
||||
# include <boost/python/args.hpp>
|
||||
# include <boost/type_traits/same_traits.hpp>
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/mpl/not.hpp>
|
||||
# include <boost/mpl/and.hpp>
|
||||
# include <boost/mpl/or.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
# include <boost/mpl/lambda.hpp>
|
||||
# include <boost/mpl/apply.hpp>
|
||||
# include <boost/tuple/tuple.hpp>
|
||||
@@ -73,7 +72,8 @@ namespace detail
|
||||
struct tuple_extract_base_select
|
||||
{
|
||||
typedef typename Tuple::head_type head_type;
|
||||
typedef typename mpl::apply1<Predicate, typename add_reference<head_type>::type>::type match_t;
|
||||
typedef typename mpl::apply1<Predicate,
|
||||
typename add_lvalue_reference<head_type>::type>::type match_t;
|
||||
BOOST_STATIC_CONSTANT(bool, match = match_t::value);
|
||||
typedef typename tuple_extract_impl<match>::template apply<Tuple,Predicate> type;
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#define DEFAULTS_DEF_JDG20020811_HPP
|
||||
|
||||
#include <boost/python/detail/defaults_gen.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/python/detail/type_traits.hpp>
|
||||
#include <boost/mpl/front.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
@@ -238,7 +238,7 @@ namespace detail
|
||||
typedef typename OverloadsT::non_void_return_type non_void_return_type;
|
||||
|
||||
typedef typename mpl::if_c<
|
||||
boost::is_same<void, return_type>::value
|
||||
is_same<void, return_type>::value
|
||||
, void_return_type
|
||||
, non_void_return_type
|
||||
>::type stubs_type;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef DESTROY_DWA2002221_HPP
|
||||
# define DESTROY_DWA2002221_HPP
|
||||
|
||||
# include <boost/type_traits/is_array.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/detail/workaround.hpp>
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
@@ -30,7 +30,7 @@ struct value_destroyer<true>
|
||||
for (T const volatile* p = first; p != first + sizeof(A)/sizeof(T); ++p)
|
||||
{
|
||||
value_destroyer<
|
||||
boost::is_array<T>::value
|
||||
is_array<T>::value
|
||||
>::execute(p);
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ inline void destroy_referent_impl(void* p, T& (*)())
|
||||
// note: cv-qualification needed for MSVC6
|
||||
// must come *before* T for metrowerks
|
||||
value_destroyer<
|
||||
(boost::is_array<T>::value)
|
||||
(is_array<T>::value)
|
||||
>::execute((const volatile T*)p);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
# include <boost/python/detail/preprocessor.hpp>
|
||||
# include <boost/python/detail/none.hpp>
|
||||
|
||||
# include <boost/type_traits/is_member_function_pointer.hpp>
|
||||
|
||||
# include <boost/preprocessor/iterate.hpp>
|
||||
# include <boost/preprocessor/facilities/intercept.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_trailing_params.hpp>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef POINTEE_DWA2002323_HPP
|
||||
# define POINTEE_DWA2002323_HPP
|
||||
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
# include <boost/type.hpp>
|
||||
|
||||
# include <boost/python/detail/preprocessor.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
|
||||
# include <boost/preprocessor/comma_if.hpp>
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
|
||||
# include <cstddef>
|
||||
# include <boost/type.hpp>
|
||||
# include <boost/type_traits/array_traits.hpp>
|
||||
# include <boost/type_traits/same_traits.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
# include <boost/detail/workaround.hpp>
|
||||
|
||||
|
||||
@@ -6,11 +6,9 @@
|
||||
# define TRANSLATE_EXCEPTION_TDS20091020_HPP
|
||||
|
||||
# include <boost/python/detail/exception_handler.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
# include <boost/call_traits.hpp>
|
||||
# include <boost/type_traits/add_const.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
# include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
# include <boost/function/function0.hpp>
|
||||
|
||||
@@ -33,7 +31,7 @@ struct translate_exception
|
||||
typename add_const<ExceptionType>::type
|
||||
>::type exception_non_ref;
|
||||
# else
|
||||
typedef typename add_reference<
|
||||
typedef typename add_lvalue_reference<
|
||||
typename add_const<ExceptionType>::type
|
||||
>::type exception_cref;
|
||||
# endif
|
||||
|
||||
110
include/boost/python/detail/type_traits.hpp
Normal file
110
include/boost/python/detail/type_traits.hpp
Normal file
@@ -0,0 +1,110 @@
|
||||
// Copyright Shreyans Doshi 2017.
|
||||
// Distributed under 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)
|
||||
|
||||
#ifndef BOOST_PYTHON_DETAIL_TYPE_TRAITS_HPP
|
||||
# define BOOST_PYTHON_DETAIL_TYPE_TRAITS_HPP
|
||||
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
# include <boost/type_traits/transform_traits.hpp>
|
||||
# include <boost/type_traits/same_traits.hpp>
|
||||
# include <boost/type_traits/cv_traits.hpp>
|
||||
# include <boost/type_traits/is_polymorphic.hpp>
|
||||
# include <boost/type_traits/composite_traits.hpp>
|
||||
# include <boost/type_traits/conversion_traits.hpp>
|
||||
# include <boost/type_traits/add_pointer.hpp>
|
||||
# include <boost/type_traits/remove_pointer.hpp>
|
||||
# include <boost/type_traits/is_void.hpp>
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/type_traits/add_lvalue_reference.hpp>
|
||||
# include <boost/type_traits/function_traits.hpp>
|
||||
# include <boost/type_traits/is_scalar.hpp>
|
||||
# include <boost/type_traits/alignment_traits.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
#else
|
||||
# include <type_traits>
|
||||
#endif
|
||||
|
||||
# include <boost/type_traits/is_base_and_derived.hpp>
|
||||
# include <boost/type_traits/alignment_traits.hpp>
|
||||
# include <boost/type_traits/has_trivial_copy.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
using boost::alignment_of;
|
||||
using boost::add_const;
|
||||
using boost::add_cv;
|
||||
using boost::add_lvalue_reference;
|
||||
using boost::add_pointer;
|
||||
|
||||
using boost::is_array;
|
||||
using boost::is_class;
|
||||
using boost::is_const;
|
||||
using boost::is_convertible;
|
||||
using boost::is_enum;
|
||||
using boost::is_function;
|
||||
using boost::is_integral;
|
||||
using boost::is_lvalue_reference;
|
||||
using boost::is_member_function_pointer;
|
||||
using boost::is_member_pointer;
|
||||
using boost::is_pointer;
|
||||
using boost::is_polymorphic;
|
||||
using boost::is_reference;
|
||||
using boost::is_same;
|
||||
using boost::is_scalar;
|
||||
using boost::is_union;
|
||||
using boost::is_void;
|
||||
using boost::is_volatile;
|
||||
|
||||
using boost::remove_reference;
|
||||
using boost::remove_pointer;
|
||||
using boost::remove_cv;
|
||||
using boost::remove_const;
|
||||
|
||||
using boost::mpl::true_;
|
||||
using boost::mpl::false_;
|
||||
#else
|
||||
using std::alignment_of;
|
||||
using std::add_const;
|
||||
using std::add_cv;
|
||||
using std::add_lvalue_reference;
|
||||
using std::add_pointer;
|
||||
|
||||
using std::is_array;
|
||||
using std::is_class;
|
||||
using std::is_const;
|
||||
using std::is_convertible;
|
||||
using std::is_enum;
|
||||
using std::is_function;
|
||||
using std::is_integral;
|
||||
using std::is_lvalue_reference;
|
||||
using std::is_member_function_pointer;
|
||||
using std::is_member_pointer;
|
||||
using std::is_pointer;
|
||||
using std::is_polymorphic;
|
||||
using std::is_reference;
|
||||
using std::is_same;
|
||||
using std::is_scalar;
|
||||
using std::is_union;
|
||||
using std::is_void;
|
||||
using std::is_volatile;
|
||||
|
||||
using std::remove_reference;
|
||||
using std::remove_pointer;
|
||||
using std::remove_cv;
|
||||
using std::remove_const;
|
||||
|
||||
using true_ = std::integral_constant<bool, true>;
|
||||
using false_ = std::integral_constant<bool, false>;
|
||||
#endif
|
||||
using boost::is_base_and_derived;
|
||||
using boost::type_with_alignment;
|
||||
using boost::has_trivial_copy;
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
|
||||
#endif //BOOST_DETAIL_TYPE_TRAITS_HPP
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
# include <boost/python/detail/cv_category.hpp>
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
@@ -155,10 +155,10 @@ unwind_type(boost::type<U>*p =0, Generator* =0)
|
||||
#endif
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(int, indirection
|
||||
= (boost::is_pointer<U>::value ? pointer_ : 0)
|
||||
= (is_pointer<U>::value ? pointer_ : 0)
|
||||
+ (indirect_traits::is_reference_to_pointer<U>::value
|
||||
? reference_to_pointer_
|
||||
: boost::is_reference<U>::value
|
||||
: is_lvalue_reference<U>::value
|
||||
? reference_
|
||||
: 0));
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
|
||||
# include <boost/python/detail/copy_ctor_mutates_rhs.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
# include <boost/type_traits/add_const.hpp>
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
@@ -16,7 +15,7 @@ struct value_arg
|
||||
: mpl::if_<
|
||||
copy_ctor_mutates_rhs<T>
|
||||
, T
|
||||
, typename add_reference<
|
||||
, typename add_lvalue_reference<
|
||||
typename add_const<T>::type
|
||||
>::type
|
||||
>
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
# include <boost/mpl/bool.hpp>
|
||||
# include <boost/preprocessor/enum_params.hpp>
|
||||
|
||||
|
||||
# include <boost/type_traits/remove_reference.hpp>
|
||||
# include <boost/type_traits/remove_cv.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/python/detail/is_xxx.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
# define BOOST_PYTHON_VALUE_IS_XXX_DEF(name, qualified_name, nargs) \
|
||||
template <class X_> \
|
||||
struct value_is_##name \
|
||||
@@ -24,9 +24,10 @@ struct value_is_##name \
|
||||
typename remove_reference<X_>::type \
|
||||
>::type \
|
||||
>::value); \
|
||||
typedef mpl::bool_<value> type; \
|
||||
typedef mpl::bool_<value> type; \
|
||||
\
|
||||
};
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
#endif // VALUE_IS_XXX_DWA2003224_HPP
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef VOID_PTR_DWA200239_HPP
|
||||
# define VOID_PTR_DWA200239_HPP
|
||||
|
||||
# include <boost/type_traits/remove_cv.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
# define WRAPPER_BASE_DWA2004722_HPP
|
||||
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
# include <boost/type_traits/is_polymorphic.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
@@ -21,14 +20,14 @@ namespace detail
|
||||
inline PyObject* get_owner(wrapper_base const volatile& w);
|
||||
|
||||
inline PyObject*
|
||||
owner_impl(void const volatile* /*x*/, mpl::false_)
|
||||
owner_impl(void const volatile* /*x*/, detail::false_)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline PyObject*
|
||||
owner_impl(T const volatile* x, mpl::true_);
|
||||
owner_impl(T const volatile* x, detail::true_);
|
||||
|
||||
template <class T>
|
||||
inline PyObject*
|
||||
@@ -59,7 +58,7 @@ namespace detail
|
||||
{
|
||||
template <class T>
|
||||
inline PyObject*
|
||||
owner_impl(T const volatile* x, mpl::true_)
|
||||
owner_impl(T const volatile* x, detail::true_)
|
||||
{
|
||||
if (wrapper_base const volatile* w = dynamic_cast<wrapper_base const volatile*>(x))
|
||||
{
|
||||
|
||||
@@ -20,6 +20,10 @@ object
|
||||
BOOST_PYTHON_DECL
|
||||
eval(str string, object global = object(), object local = object());
|
||||
|
||||
object
|
||||
BOOST_PYTHON_DECL
|
||||
eval(char const *string, object global = object(), object local = object());
|
||||
|
||||
// Execute an individual python statement from str.
|
||||
// global and local are the global and local scopes respectively,
|
||||
// used during execution.
|
||||
@@ -27,6 +31,10 @@ object
|
||||
BOOST_PYTHON_DECL
|
||||
exec_statement(str string, object global = object(), object local = object());
|
||||
|
||||
object
|
||||
BOOST_PYTHON_DECL
|
||||
exec_statement(char const *string, object global = object(), object local = object());
|
||||
|
||||
// Execute python source code from str.
|
||||
// global and local are the global and local scopes respectively,
|
||||
// used during execution.
|
||||
@@ -34,6 +42,10 @@ object
|
||||
BOOST_PYTHON_DECL
|
||||
exec(str string, object global = object(), object local = object());
|
||||
|
||||
object
|
||||
BOOST_PYTHON_DECL
|
||||
exec(char const *string, object global = object(), object local = object());
|
||||
|
||||
// Execute python source code from file filename.
|
||||
// global and local are the global and local scopes respectively,
|
||||
// used during execution.
|
||||
@@ -41,6 +53,10 @@ object
|
||||
BOOST_PYTHON_DECL
|
||||
exec_file(str filename, object global = object(), object local = object());
|
||||
|
||||
object
|
||||
BOOST_PYTHON_DECL
|
||||
exec_file(char const *filename, object global = object(), object local = object());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <boost/mpl/joint_view.hpp>
|
||||
#include <boost/mpl/back.hpp>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
#include <boost/preprocessor/enum_params_with_a_default.hpp>
|
||||
#include <boost/preprocessor/enum_params.hpp>
|
||||
|
||||
@@ -8,12 +8,10 @@
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
|
||||
# include <boost/python/detail/target.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/python/object/iterator.hpp>
|
||||
# include <boost/python/object_core.hpp>
|
||||
|
||||
# include <boost/type_traits/cv_traits.hpp>
|
||||
# include <boost/type_traits/transform_traits.hpp>
|
||||
|
||||
# if defined(BOOST_MSVC) && (BOOST_MSVC == 1400) /*
|
||||
> warning C4180: qualifier applied to function type has no meaning; ignored
|
||||
Peter Dimov wrote:
|
||||
@@ -80,7 +78,7 @@ namespace detail
|
||||
template <class T>
|
||||
struct iterators
|
||||
: detail::iterators_impl<
|
||||
boost::is_const<T>::value
|
||||
detail::is_const<T>::value
|
||||
>::template apply<T>
|
||||
{
|
||||
};
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# include <boost/python/type_id.hpp>
|
||||
# include <boost/python/converter/registry.hpp>
|
||||
# include <boost/python/detail/void_ptr.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
@@ -35,7 +36,7 @@ namespace detail
|
||||
{
|
||||
static inline void* execute(PyObject* op)
|
||||
{
|
||||
typedef typename boost::add_reference<U>::type param;
|
||||
typedef typename add_lvalue_reference<U>::type param;
|
||||
return &Extractor::execute(
|
||||
boost::python::detail::void_ptr_to_reference(
|
||||
op, (param(*)())0 )
|
||||
|
||||
@@ -43,19 +43,19 @@ namespace detail
|
||||
|
||||
private:
|
||||
template <class U>
|
||||
void dispatch(U* x, mpl::true_) const
|
||||
void dispatch(U* x, detail::true_) const
|
||||
{
|
||||
#if __cplusplus < 201103L
|
||||
std::auto_ptr<U> owner(x);
|
||||
dispatch(owner, mpl::false_());
|
||||
dispatch(owner, detail::false_());
|
||||
#else
|
||||
std::unique_ptr<U> owner(x);
|
||||
dispatch(std::move(owner), mpl::false_());
|
||||
dispatch(std::move(owner), detail::false_());
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class Ptr>
|
||||
void dispatch(Ptr x, mpl::false_) const
|
||||
void dispatch(Ptr x, detail::false_) const
|
||||
{
|
||||
typedef typename pointee<Ptr>::type value_type;
|
||||
typedef objects::pointer_holder<Ptr,value_type> holder;
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/python/to_python_indirect.hpp>
|
||||
# include <boost/type_traits/composite_traits.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
@@ -29,7 +29,7 @@ struct manage_new_object
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::if_c<
|
||||
boost::is_pointer<T>::value
|
||||
detail::is_pointer<T>::value
|
||||
, to_python_indirect<T, detail::make_owning_holder>
|
||||
, detail::manage_new_object_requires_a_pointer_return_type<T>
|
||||
>::type type;
|
||||
|
||||
@@ -62,7 +62,11 @@
|
||||
// Set the name of our library, this will get undef'ed by auto_link.hpp
|
||||
// once it's done with it:
|
||||
//
|
||||
#define BOOST_LIB_NAME boost_numpy
|
||||
#if PY_MAJOR_VERSION == 2
|
||||
# define BOOST_LIB_NAME boost_numpy
|
||||
#elif PY_MAJOR_VERSION == 3
|
||||
# define BOOST_LIB_NAME boost_numpy3
|
||||
#endif
|
||||
//
|
||||
// If we're importing code from a dll, then tell auto_link.hpp about it:
|
||||
//
|
||||
@@ -75,4 +79,6 @@
|
||||
#include <boost/config/auto_link.hpp>
|
||||
#endif // auto-linking disabled
|
||||
|
||||
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
|
||||
|
||||
#endif // CONFIG_NUMPY20170215_H_
|
||||
|
||||
@@ -13,11 +13,10 @@
|
||||
*/
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/python/numpy/numpy_object_mgr_traits.hpp>
|
||||
#include <boost/python/numpy/config.hpp>
|
||||
|
||||
#include <boost/python/numpy/numpy_object_mgr_traits.hpp>
|
||||
#include <boost/mpl/for_each.hpp>
|
||||
#include <boost/type_traits/add_pointer.hpp>
|
||||
#include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace numpy {
|
||||
|
||||
@@ -90,7 +89,7 @@ struct builtin_dtype<T,true> {
|
||||
};
|
||||
|
||||
template <>
|
||||
struct builtin_dtype<bool,true> {
|
||||
struct BOOST_NUMPY_DECL builtin_dtype<bool,true> {
|
||||
static dtype get();
|
||||
};
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/python/numpy/config.hpp>
|
||||
#ifdef BOOST_PYTHON_NUMPY_INTERNAL
|
||||
#define NO_IMPORT_ARRAY
|
||||
#define NO_IMPORT_UFUNC
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/python/detail/type_traits.hpp>
|
||||
#include <boost/python/numpy/numpy_object_mgr_traits.hpp>
|
||||
#include <boost/python/numpy/dtype.hpp>
|
||||
#include <boost/python/numpy/config.hpp>
|
||||
@@ -176,7 +176,7 @@ ndarray from_data_impl(void * data,
|
||||
Container strides,
|
||||
object const & owner,
|
||||
bool writeable,
|
||||
typename boost::enable_if< boost::is_integral<typename Container::value_type> >::type * enabled = NULL)
|
||||
typename boost::enable_if< boost::python::detail::is_integral<typename Container::value_type> >::type * enabled = NULL)
|
||||
{
|
||||
std::vector<Py_intptr_t> shape_(shape.begin(),shape.end());
|
||||
std::vector<Py_intptr_t> strides_(strides.begin(), strides.end());
|
||||
|
||||
@@ -17,14 +17,11 @@
|
||||
|
||||
#include <boost/python/detail/force_instantiate.hpp>
|
||||
#include <boost/python/detail/not_specified.hpp>
|
||||
#include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
#include <boost/python/has_back_reference.hpp>
|
||||
#include <boost/python/bases.hpp>
|
||||
|
||||
#include <boost/type_traits/add_pointer.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/is_polymorphic.hpp>
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
@@ -35,9 +32,6 @@
|
||||
#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>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
@@ -56,7 +50,7 @@ struct register_base_of
|
||||
template <class Base>
|
||||
inline void operator()(Base*) const
|
||||
{
|
||||
BOOST_MPL_ASSERT_NOT((is_same<Base,Derived>));
|
||||
BOOST_MPL_ASSERT_NOT((boost::python::detail::is_same<Base,Derived>));
|
||||
|
||||
// Register the Base class
|
||||
register_dynamic_id<Base>();
|
||||
@@ -65,14 +59,14 @@ struct register_base_of
|
||||
register_conversion<Derived,Base>(false);
|
||||
|
||||
// Register the down-cast, if appropriate.
|
||||
this->register_downcast((Base*)0, is_polymorphic<Base>());
|
||||
this->register_downcast((Base*)0, boost::python::detail::is_polymorphic<Base>());
|
||||
}
|
||||
|
||||
private:
|
||||
static inline void register_downcast(void*, mpl::false_) {}
|
||||
static inline void register_downcast(void*, boost::python::detail::false_) {}
|
||||
|
||||
template <class Base>
|
||||
static inline void register_downcast(Base*, mpl::true_)
|
||||
static inline void register_downcast(Base*, boost::python::detail::true_)
|
||||
{
|
||||
register_conversion<Base, Derived>(true);
|
||||
}
|
||||
@@ -98,7 +92,7 @@ inline void register_shared_ptr_from_python_and_casts(T*, Bases)
|
||||
// interface to mpl::for_each to avoid an MSVC 6 bug.
|
||||
//
|
||||
register_dynamic_id<T>();
|
||||
mpl::for_each(register_base_of<T>(), (Bases*)0, (add_pointer<mpl::_>*)0);
|
||||
mpl::for_each(register_base_of<T>(), (Bases*)0, (boost::python::detail::add_pointer<mpl::_>*)0);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -109,7 +103,7 @@ struct select_held_type
|
||||
: mpl::if_<
|
||||
mpl::or_<
|
||||
python::detail::specifies_bases<T>
|
||||
, is_same<T,noncopyable>
|
||||
, boost::python::detail::is_same<T,noncopyable>
|
||||
>
|
||||
, Prev
|
||||
, T
|
||||
@@ -156,9 +150,9 @@ struct class_metadata
|
||||
>::type bases;
|
||||
|
||||
typedef mpl::or_<
|
||||
is_same<X1,noncopyable>
|
||||
, is_same<X2,noncopyable>
|
||||
, is_same<X3,noncopyable>
|
||||
boost::python::detail::is_same<X1,noncopyable>
|
||||
, boost::python::detail::is_same<X2,noncopyable>
|
||||
, boost::python::detail::is_same<X3,noncopyable>
|
||||
> is_noncopyable;
|
||||
|
||||
//
|
||||
@@ -167,11 +161,11 @@ struct class_metadata
|
||||
|
||||
// Compute the actual type that will be held in the Holder.
|
||||
typedef typename mpl::if_<
|
||||
is_same<held_type_arg,python::detail::not_specified>, T, held_type_arg
|
||||
boost::python::detail::is_same<held_type_arg,python::detail::not_specified>, T, held_type_arg
|
||||
>::type held_type;
|
||||
|
||||
// Determine if the object will be held by value
|
||||
typedef mpl::bool_<is_convertible<held_type*,T*>::value> use_value_holder;
|
||||
typedef mpl::bool_<boost::python::detail::is_convertible<held_type*,T*>::value> use_value_holder;
|
||||
|
||||
// Compute the "wrapped type", that is, if held_type is a smart
|
||||
// pointer, we're talking about the pointee.
|
||||
@@ -185,7 +179,7 @@ struct class_metadata
|
||||
typedef mpl::bool_<
|
||||
mpl::or_<
|
||||
has_back_reference<T>
|
||||
, is_same<held_type_arg,T>
|
||||
, boost::python::detail::is_same<held_type_arg,T>
|
||||
, is_base_and_derived<T,wrapped>
|
||||
>::value
|
||||
> use_back_reference;
|
||||
@@ -214,7 +208,7 @@ struct class_metadata
|
||||
template <class T2>
|
||||
inline static void register_aux(python::wrapper<T2>*)
|
||||
{
|
||||
typedef typename mpl::not_<is_same<T2,wrapped> >::type use_callback;
|
||||
typedef typename mpl::not_<boost::python::detail::is_same<T2,wrapped> >::type use_callback;
|
||||
class_metadata::register_aux2((T2*)0, use_callback());
|
||||
}
|
||||
|
||||
@@ -243,7 +237,7 @@ struct class_metadata
|
||||
inline static void maybe_register_pointer_to_python(...) {}
|
||||
|
||||
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
|
||||
inline static void maybe_register_pointer_to_python(void*,void*,mpl::true_*)
|
||||
inline static void maybe_register_pointer_to_python(void*,void*,mpl::true_*)
|
||||
{
|
||||
objects::copy_class_object(python::type_id<T>(), python::type_id<back_reference<T const &> >());
|
||||
objects::copy_class_object(python::type_id<T>(), python::type_id<back_reference<T &> >());
|
||||
|
||||
@@ -6,11 +6,9 @@
|
||||
# define FORWARD_DWA20011215_HPP
|
||||
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/type_traits/is_scalar.hpp>
|
||||
# include <boost/type_traits/add_const.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
# include <boost/ref.hpp>
|
||||
# include <boost/python/detail/value_arg.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/python/detail/copy_ctor_mutates_rhs.hpp>
|
||||
# include <boost/mpl/or.hpp>
|
||||
|
||||
@@ -22,7 +20,8 @@ namespace boost { namespace python { namespace objects {
|
||||
template <class T>
|
||||
struct reference_to_value
|
||||
{
|
||||
typedef typename add_reference<typename add_const<T>::type>::type reference;
|
||||
typedef typename boost::python::detail::add_lvalue_reference<typename
|
||||
boost::python::detail::add_const<T>::type>::type reference;
|
||||
|
||||
reference_to_value(reference x) : m_value(x) {}
|
||||
reference get() const { return m_value; }
|
||||
@@ -36,7 +35,7 @@ struct reference_to_value
|
||||
template <class T>
|
||||
struct forward
|
||||
: mpl::if_<
|
||||
mpl::or_<python::detail::copy_ctor_mutates_rhs<T>, is_scalar<T> >
|
||||
mpl::or_<python::detail::copy_ctor_mutates_rhs<T>, boost::python::detail::is_scalar<T> >
|
||||
, T
|
||||
, reference_to_value<T>
|
||||
>
|
||||
@@ -65,7 +64,7 @@ struct unforward_cref
|
||||
|
||||
template<typename T>
|
||||
struct unforward_cref<reference_to_value<T> >
|
||||
: add_reference<typename add_const<T>::type>
|
||||
: boost::python::detail::add_lvalue_reference<typename boost::python::detail::add_const<T>::type>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
@@ -8,9 +8,8 @@
|
||||
# include <boost/python/type_id.hpp>
|
||||
# include <boost/shared_ptr.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/type_traits/is_polymorphic.hpp>
|
||||
# include <boost/type_traits/is_base_and_derived.hpp>
|
||||
# include <boost/detail/workaround.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
|
||||
@@ -58,7 +57,7 @@ struct non_polymorphic_id_generator
|
||||
template <class T>
|
||||
struct dynamic_id_generator
|
||||
: mpl::if_<
|
||||
boost::is_polymorphic<T>
|
||||
boost::python::detail::is_polymorphic<T>
|
||||
, boost::python::objects::polymorphic_id_generator<T>
|
||||
, boost::python::objects::non_polymorphic_id_generator<T>
|
||||
>
|
||||
@@ -104,7 +103,7 @@ struct implicit_cast_generator
|
||||
template <class Source, class Target>
|
||||
struct cast_generator
|
||||
: mpl::if_<
|
||||
is_base_and_derived<Target,Source>
|
||||
detail::is_base_and_derived<Target,Source>
|
||||
, implicit_cast_generator<Source,Target>
|
||||
, dynamic_cast_generator<Source,Target>
|
||||
>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# define INSTANCE_DWA200295_HPP
|
||||
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
# include <boost/type_traits/alignment_traits.hpp>
|
||||
|
||||
# include <cstddef>
|
||||
|
||||
namespace boost { namespace python
|
||||
@@ -25,8 +25,8 @@ struct instance
|
||||
PyObject* weakrefs;
|
||||
instance_holder* objects;
|
||||
|
||||
typedef typename type_with_alignment<
|
||||
::boost::alignment_of<Data>::value
|
||||
typedef typename boost::python::detail::type_with_alignment<
|
||||
boost::python::detail::alignment_of<Data>::value
|
||||
>::type align_t;
|
||||
|
||||
union
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
# define ITERATOR_DWA2002510_HPP
|
||||
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
# include <boost/python/class.hpp>
|
||||
# include <boost/python/return_value_policy.hpp>
|
||||
@@ -24,10 +25,6 @@
|
||||
|
||||
# include <boost/type.hpp>
|
||||
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
# include <boost/type_traits/add_const.hpp>
|
||||
|
||||
# include <boost/detail/iterator.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
@@ -202,8 +199,8 @@ inline object make_iterator_function(
|
||||
)
|
||||
{
|
||||
typedef typename Accessor1::result_type iterator;
|
||||
typedef typename add_const<iterator>::type iterator_const;
|
||||
typedef typename add_reference<iterator_const>::type iterator_cref;
|
||||
typedef typename boost::python::detail::add_const<iterator>::type iterator_const;
|
||||
typedef typename boost::python::detail::add_lvalue_reference<iterator_const>::type iterator_cref;
|
||||
|
||||
return detail::make_iterator_function(
|
||||
get_start
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
# include <boost/python/object/instance.hpp>
|
||||
# include <boost/python/converter/registered.hpp>
|
||||
# include <boost/python/detail/decref_guard.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/python/detail/none.hpp>
|
||||
# include <boost/mpl/assert.hpp>
|
||||
# include <boost/mpl/or.hpp>
|
||||
# include <boost/type_traits/is_union.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
|
||||
@@ -24,7 +24,8 @@ struct make_instance_impl
|
||||
template <class Arg>
|
||||
static inline PyObject* execute(Arg& x)
|
||||
{
|
||||
BOOST_MPL_ASSERT((mpl::or_<is_class<T>, is_union<T> >));
|
||||
BOOST_MPL_ASSERT((mpl::or_<boost::python::detail::is_class<T>,
|
||||
boost::python::detail::is_union<T> >));
|
||||
|
||||
PyTypeObject* type = Derived::get_class_object(x);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
# include <boost/python/object/make_instance.hpp>
|
||||
# include <boost/python/converter/registry.hpp>
|
||||
# include <boost/type_traits/is_polymorphic.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/get_pointer.hpp>
|
||||
# include <boost/detail/workaround.hpp>
|
||||
# include <typeinfo>
|
||||
@@ -47,7 +47,7 @@ struct make_ptr_instance
|
||||
return 0; // means "return None".
|
||||
|
||||
PyTypeObject* derived = get_derived_class_object(
|
||||
BOOST_DEDUCED_TYPENAME is_polymorphic<U>::type(), p);
|
||||
BOOST_DEDUCED_TYPENAME boost::python::detail::is_polymorphic<U>::type(), p);
|
||||
|
||||
if (derived)
|
||||
return derived;
|
||||
@@ -55,7 +55,7 @@ struct make_ptr_instance
|
||||
}
|
||||
|
||||
template <class U>
|
||||
static inline PyTypeObject* get_derived_class_object(mpl::true_, U const volatile* x)
|
||||
static inline PyTypeObject* get_derived_class_object(boost::python::detail::true_, U const volatile* x)
|
||||
{
|
||||
converter::registration const* r = converter::registry::query(
|
||||
type_info(typeid(*get_pointer(x)))
|
||||
@@ -64,7 +64,7 @@ struct make_ptr_instance
|
||||
}
|
||||
|
||||
template <class U>
|
||||
static inline PyTypeObject* get_derived_class_object(mpl::false_, U*)
|
||||
static inline PyTypeObject* get_derived_class_object(boost::python::detail::false_, U*)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
# include <boost/python/detail/wrapper_base.hpp>
|
||||
# include <boost/python/detail/force_instantiate.hpp>
|
||||
# include <boost/python/detail/preprocessor.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
|
||||
# include <boost/mpl/if.hpp>
|
||||
@@ -35,8 +36,6 @@
|
||||
|
||||
# include <boost/detail/workaround.hpp>
|
||||
|
||||
# include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
template <class T> class wrapper;
|
||||
@@ -128,7 +127,7 @@ inline pointer_holder_back_reference<Pointer,Value>::pointer_holder_back_referen
|
||||
template <class Pointer, class Value>
|
||||
void* pointer_holder<Pointer, Value>::holds(type_info dst_t, bool null_ptr_only)
|
||||
{
|
||||
typedef typename boost::remove_const< Value >::type non_const_value;
|
||||
typedef typename boost::python::detail::remove_const< Value >::type non_const_value;
|
||||
|
||||
if (dst_t == python::type_id<Pointer>()
|
||||
&& !(null_ptr_only && get_pointer(this->m_p))
|
||||
|
||||
@@ -31,10 +31,7 @@
|
||||
# include <boost/python/detail/is_xxx.hpp>
|
||||
# include <boost/python/detail/string_literal.hpp>
|
||||
# include <boost/python/detail/def_helper_fwd.hpp>
|
||||
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
# include <boost/type_traits/is_convertible.hpp>
|
||||
# include <boost/type_traits/remove_reference.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
@@ -165,7 +162,7 @@ namespace api
|
||||
// It's too late to specify anything other than docstrings if
|
||||
// the callable object is already wrapped.
|
||||
BOOST_STATIC_ASSERT(
|
||||
(is_same<char const*,DocStringT>::value
|
||||
(detail::is_same<char const*,DocStringT>::value
|
||||
|| detail::is_string_literal<DocStringT const>::value));
|
||||
|
||||
objects::add_to_namespace(cl, name, this->derived_visitor(), helper.doc());
|
||||
@@ -208,8 +205,8 @@ namespace api
|
||||
|
||||
template <class T, class U>
|
||||
struct is_derived
|
||||
: is_convertible<
|
||||
typename remove_reference<T>::type*
|
||||
: boost::python::detail::is_convertible<
|
||||
typename detail::remove_reference<T>::type*
|
||||
, U const*
|
||||
>
|
||||
{};
|
||||
@@ -280,14 +277,14 @@ namespace api
|
||||
struct object_initializer_impl
|
||||
{
|
||||
static PyObject*
|
||||
get(object const& x, mpl::true_)
|
||||
get(object const& x, detail::true_)
|
||||
{
|
||||
return python::incref(x.ptr());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static PyObject*
|
||||
get(T const& x, mpl::false_)
|
||||
get(T const& x, detail::false_)
|
||||
{
|
||||
return python::incref(converter::arg_to_python<T>(x).get());
|
||||
}
|
||||
@@ -298,7 +295,7 @@ namespace api
|
||||
{
|
||||
template <class Policies>
|
||||
static PyObject*
|
||||
get(proxy<Policies> const& x, mpl::false_)
|
||||
get(proxy<Policies> const& x, detail::false_)
|
||||
{
|
||||
return python::incref(x.operator object().ptr());
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright Gottfried Ganßauge 2003..2006.
|
||||
// Copyright Gottfried Ganßauge 2003..2006.
|
||||
// Distributed under 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)
|
||||
@@ -13,14 +13,11 @@
|
||||
# include <boost/python/to_python_converter.hpp>
|
||||
# include <boost/python/converter/registrations.hpp>
|
||||
# include <boost/python/detail/dealloc.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/python/detail/none.hpp>
|
||||
# include <boost/python/type_id.hpp>
|
||||
# include <boost/python/errors.hpp>
|
||||
|
||||
# include <boost/type_traits/remove_pointer.hpp>
|
||||
# include <boost/type_traits/is_pointer.hpp>
|
||||
# include <boost/type_traits/is_void.hpp>
|
||||
|
||||
# include <boost/implicit_cast.hpp>
|
||||
|
||||
# include <boost/mpl/eval_if.hpp>
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
# define POINTEE_DWA2002323_HPP
|
||||
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/type_traits/remove_pointer.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
@@ -17,7 +15,7 @@ namespace detail
|
||||
template <bool is_ptr = true>
|
||||
struct pointee_impl
|
||||
{
|
||||
template <class T> struct apply : remove_pointer<T> {};
|
||||
template <class T> struct apply : detail::remove_pointer<T> {};
|
||||
};
|
||||
|
||||
template <>
|
||||
@@ -33,11 +31,11 @@ namespace detail
|
||||
template <class T>
|
||||
struct pointee
|
||||
: detail::pointee_impl<
|
||||
::boost::is_pointer<T>::value
|
||||
detail::is_pointer<T>::value
|
||||
>::template apply<T>
|
||||
{
|
||||
};
|
||||
|
||||
}} // namespace boost::python::detail
|
||||
}} // namespace boost::python
|
||||
|
||||
#endif // POINTEE_DWA2002323_HPP
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# include <boost/python/detail/indirect_traits.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/python/to_python_indirect.hpp>
|
||||
# include <boost/type_traits/composite_traits.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
@@ -31,7 +31,7 @@ struct reference_existing_object
|
||||
struct apply
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, ok = is_pointer<T>::value || is_reference<T>::value);
|
||||
bool, ok = detail::is_pointer<T>::value || detail::is_reference<T>::value);
|
||||
|
||||
typedef typename mpl::if_c<
|
||||
ok
|
||||
|
||||
@@ -12,8 +12,7 @@
|
||||
# include <boost/python/converter/pytype_function.hpp>
|
||||
#endif
|
||||
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
# include <boost/type_traits/add_const.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
# include <boost/mpl/int.hpp>
|
||||
# include <boost/mpl/at.hpp>
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
|
||||
# include <boost/python/to_python_value.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
# include <boost/type_traits/add_const.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
# include <boost/python/detail/value_arg.hpp>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright Gottfried Ganßauge 2003.
|
||||
// Copyright Gottfried Ganßauge 2003.
|
||||
// Distributed under 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)
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
# include <boost/python/detail/preprocessor.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/preprocessor/repeat.hpp>
|
||||
# include <boost/preprocessor/enum.hpp>
|
||||
# include <boost/preprocessor/enum_params.hpp>
|
||||
@@ -42,7 +42,7 @@ template <class C1, class C2>
|
||||
struct most_derived
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
is_convertible<C1*,C2*>
|
||||
detail::is_convertible<C1*,C2*>
|
||||
, C1
|
||||
, C2
|
||||
>::type type;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# include <boost/get_pointer.hpp>
|
||||
# include <boost/detail/binary_search.hpp>
|
||||
# include <boost/numeric/conversion/cast.hpp>
|
||||
# include <boost/type_traits/is_pointer.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
# include <vector>
|
||||
# include <map>
|
||||
#include <iostream>
|
||||
@@ -465,14 +465,14 @@ namespace boost { namespace python { namespace detail {
|
||||
|
||||
template <class DataType>
|
||||
static object
|
||||
base_get_item_helper(DataType const& p, mpl::true_)
|
||||
base_get_item_helper(DataType const& p, detail::true_)
|
||||
{
|
||||
return object(ptr(p));
|
||||
}
|
||||
|
||||
template <class DataType>
|
||||
static object
|
||||
base_get_item_helper(DataType const& x, mpl::false_)
|
||||
base_get_item_helper(DataType const& x, detail::false_)
|
||||
{
|
||||
return object(x);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# include <boost/python/iterator.hpp>
|
||||
# include <boost/mpl/or.hpp>
|
||||
# include <boost/mpl/not.hpp>
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
@@ -122,10 +122,10 @@ namespace boost { namespace python {
|
||||
mpl::bool_<NoProxy>
|
||||
, mpl::not_<is_class<Data> >
|
||||
, typename mpl::or_<
|
||||
is_same<Data, std::string>
|
||||
, is_same<Data, std::complex<float> >
|
||||
, is_same<Data, std::complex<double> >
|
||||
, is_same<Data, std::complex<long double> > >::type>
|
||||
detail::is_same<Data, std::string>
|
||||
, detail::is_same<Data, std::complex<float> >
|
||||
, detail::is_same<Data, std::complex<double> >
|
||||
, detail::is_same<Data, std::complex<long double> > >::type>
|
||||
no_proxy;
|
||||
|
||||
typedef detail::container_element<Container, Index, DerivedPolicies>
|
||||
|
||||
@@ -18,10 +18,7 @@
|
||||
|
||||
# include <boost/python/refcount.hpp>
|
||||
|
||||
# include <boost/type_traits/is_pointer.hpp>
|
||||
# include <boost/type_traits/is_polymorphic.hpp>
|
||||
|
||||
# include <boost/mpl/bool.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
# if defined(__ICL) && __ICL < 600
|
||||
# include <boost/shared_ptr.hpp>
|
||||
@@ -38,7 +35,7 @@ struct to_python_indirect
|
||||
inline PyObject*
|
||||
operator()(U const& ref) const
|
||||
{
|
||||
return this->execute(const_cast<U&>(ref), is_pointer<U>());
|
||||
return this->execute(const_cast<U&>(ref), detail::is_pointer<U>());
|
||||
}
|
||||
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
|
||||
inline PyTypeObject const*
|
||||
@@ -49,20 +46,20 @@ struct to_python_indirect
|
||||
#endif
|
||||
private:
|
||||
template <class U>
|
||||
inline PyObject* execute(U* ptr, mpl::true_) const
|
||||
inline PyObject* execute(U* ptr, detail::true_) const
|
||||
{
|
||||
// No special NULL treatment for references
|
||||
if (ptr == 0)
|
||||
return python::detail::none();
|
||||
else
|
||||
return this->execute(*ptr, mpl::false_());
|
||||
return this->execute(*ptr, detail::false_());
|
||||
}
|
||||
|
||||
template <class U>
|
||||
inline PyObject* execute(U const& x, mpl::false_) const
|
||||
inline PyObject* execute(U const& x, detail::false_) const
|
||||
{
|
||||
U* const p = &const_cast<U&>(x);
|
||||
if (is_polymorphic<U>::value)
|
||||
if (detail::is_polymorphic<U>::value)
|
||||
{
|
||||
if (PyObject* o = detail::wrapper_base_::owner(p))
|
||||
return incref(o);
|
||||
|
||||
@@ -19,14 +19,12 @@
|
||||
#include <boost/python/converter/object_manager.hpp>
|
||||
#include <boost/python/converter/shared_ptr_to_python.hpp>
|
||||
|
||||
#include <boost/python/detail/type_traits.hpp>
|
||||
#include <boost/python/detail/value_is_shared_ptr.hpp>
|
||||
#include <boost/python/detail/value_arg.hpp>
|
||||
|
||||
#include <boost/type_traits/transform_traits.hpp>
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# include <ostream>
|
||||
# include <boost/static_assert.hpp>
|
||||
# include <boost/detail/workaround.hpp>
|
||||
# include <boost/type_traits/same_traits.hpp>
|
||||
# include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
# ifndef BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE
|
||||
# if defined(__GNUC__) \
|
||||
|
||||
56
src/exec.cpp
56
src/exec.cpp
@@ -15,6 +15,11 @@ namespace python
|
||||
{
|
||||
|
||||
object BOOST_PYTHON_DECL eval(str string, object global, object local)
|
||||
{
|
||||
return eval(python::extract<char const *>(string));
|
||||
}
|
||||
|
||||
object BOOST_PYTHON_DECL eval(char const *string, object global, object local)
|
||||
{
|
||||
// Set suitable default values for global and local dicts.
|
||||
if (global.is_none())
|
||||
@@ -26,7 +31,7 @@ object BOOST_PYTHON_DECL eval(str string, object global, object local)
|
||||
}
|
||||
if (local.is_none()) local = global;
|
||||
// should be 'char const *' but older python versions don't use 'const' yet.
|
||||
char *s = python::extract<char *>(string);
|
||||
char *s = const_cast<char *>(string);
|
||||
PyObject* result = PyRun_String(s, Py_eval_input, global.ptr(), local.ptr());
|
||||
if (!result) throw_error_already_set();
|
||||
return object(detail::new_reference(result));
|
||||
@@ -34,23 +39,10 @@ object BOOST_PYTHON_DECL eval(str string, object global, object local)
|
||||
|
||||
object BOOST_PYTHON_DECL exec(str string, object global, object local)
|
||||
{
|
||||
// Set suitable default values for global and local dicts.
|
||||
if (global.is_none())
|
||||
{
|
||||
if (PyObject *g = PyEval_GetGlobals())
|
||||
global = object(detail::borrowed_reference(g));
|
||||
else
|
||||
global = dict();
|
||||
}
|
||||
if (local.is_none()) local = global;
|
||||
// should be 'char const *' but older python versions don't use 'const' yet.
|
||||
char *s = python::extract<char *>(string);
|
||||
PyObject* result = PyRun_String(s, Py_file_input, global.ptr(), local.ptr());
|
||||
if (!result) throw_error_already_set();
|
||||
return object(detail::new_reference(result));
|
||||
return exec(python::extract<char const *>(string));
|
||||
}
|
||||
|
||||
object BOOST_PYTHON_DECL exec_statement(str string, object global, object local)
|
||||
object BOOST_PYTHON_DECL exec(char const *string, object global, object local)
|
||||
{
|
||||
// Set suitable default values for global and local dicts.
|
||||
if (global.is_none())
|
||||
@@ -62,7 +54,30 @@ object BOOST_PYTHON_DECL exec_statement(str string, object global, object local)
|
||||
}
|
||||
if (local.is_none()) local = global;
|
||||
// should be 'char const *' but older python versions don't use 'const' yet.
|
||||
char *s = python::extract<char *>(string);
|
||||
char *s = const_cast<char *>(string);
|
||||
PyObject* result = PyRun_String(s, Py_file_input, global.ptr(), local.ptr());
|
||||
if (!result) throw_error_already_set();
|
||||
return object(detail::new_reference(result));
|
||||
}
|
||||
|
||||
object BOOST_PYTHON_DECL exec_statement(str string, object global, object local)
|
||||
{
|
||||
return exec_statement(python::extract<char const *>(string), global, local);
|
||||
}
|
||||
|
||||
object BOOST_PYTHON_DECL exec_statement(char const *string, object global, object local)
|
||||
{
|
||||
// Set suitable default values for global and local dicts.
|
||||
if (global.is_none())
|
||||
{
|
||||
if (PyObject *g = PyEval_GetGlobals())
|
||||
global = object(detail::borrowed_reference(g));
|
||||
else
|
||||
global = dict();
|
||||
}
|
||||
if (local.is_none()) local = global;
|
||||
// should be 'char const *' but older python versions don't use 'const' yet.
|
||||
char *s = const_cast<char *>(string);
|
||||
PyObject* result = PyRun_String(s, Py_single_input, global.ptr(), local.ptr());
|
||||
if (!result) throw_error_already_set();
|
||||
return object(detail::new_reference(result));
|
||||
@@ -72,6 +87,11 @@ object BOOST_PYTHON_DECL exec_statement(str string, object global, object local)
|
||||
// global and local are the global and local scopes respectively,
|
||||
// used during execution.
|
||||
object BOOST_PYTHON_DECL exec_file(str filename, object global, object local)
|
||||
{
|
||||
return exec_file(python::extract<char const *>(filename), global, local);
|
||||
}
|
||||
|
||||
object BOOST_PYTHON_DECL exec_file(char const *filename, object global, object local)
|
||||
{
|
||||
// Set suitable default values for global and local dicts.
|
||||
if (global.is_none())
|
||||
@@ -83,7 +103,7 @@ object BOOST_PYTHON_DECL exec_file(str filename, object global, object local)
|
||||
}
|
||||
if (local.is_none()) local = global;
|
||||
// should be 'char const *' but older python versions don't use 'const' yet.
|
||||
char *f = python::extract<char *>(filename);
|
||||
char *f = const_cast<char *>(filename);
|
||||
// Let python open the file to avoid potential binary incompatibilities.
|
||||
#if PY_VERSION_HEX >= 0x03040000
|
||||
FILE *fs = _Py_fopen(f, "r");
|
||||
|
||||
40
src/numpy/dtype.cpp
Normal file → Executable file
40
src/numpy/dtype.cpp
Normal file → Executable file
@@ -11,29 +11,33 @@
|
||||
#include <boost/python/numpy/internal.hpp>
|
||||
|
||||
#define DTYPE_FROM_CODE(code) \
|
||||
dtype(python::detail::new_reference(reinterpret_cast<PyObject*>(PyArray_DescrFromType(code))))
|
||||
dtype(python::detail::new_reference(reinterpret_cast<PyObject*>(PyArray_DescrFromType(code))))
|
||||
|
||||
#define BUILTIN_INT_DTYPE(bits) \
|
||||
template <> struct builtin_int_dtype< bits, false > { \
|
||||
static dtype get() { return DTYPE_FROM_CODE(NPY_INT ## bits); } \
|
||||
}; \
|
||||
template <> struct builtin_int_dtype< bits, true > { \
|
||||
static dtype get() { return DTYPE_FROM_CODE(NPY_UINT ## bits); } \
|
||||
}; \
|
||||
template dtype get_int_dtype< bits, false >(); \
|
||||
template dtype get_int_dtype< bits, true >()
|
||||
template <> struct builtin_int_dtype<bits, false> \
|
||||
{ \
|
||||
static dtype get() { return DTYPE_FROM_CODE(NPY_INT ## bits);} \
|
||||
}; \
|
||||
template <> struct builtin_int_dtype<bits, true> \
|
||||
{ \
|
||||
static dtype get() { return DTYPE_FROM_CODE(NPY_UINT ## bits);} \
|
||||
}; \
|
||||
template BOOST_NUMPY_DECL dtype get_int_dtype<bits, false>(); \
|
||||
template BOOST_NUMPY_DECL dtype get_int_dtype<bits, true>()
|
||||
|
||||
#define BUILTIN_FLOAT_DTYPE(bits) \
|
||||
template <> struct builtin_float_dtype< bits > { \
|
||||
static dtype get() { return DTYPE_FROM_CODE(NPY_FLOAT ## bits); } \
|
||||
}; \
|
||||
template dtype get_float_dtype< bits >()
|
||||
template <> struct builtin_float_dtype<bits> \
|
||||
{ \
|
||||
static dtype get() { return DTYPE_FROM_CODE(NPY_FLOAT ## bits);} \
|
||||
}; \
|
||||
template BOOST_NUMPY_DECL dtype get_float_dtype<bits>()
|
||||
|
||||
#define BUILTIN_COMPLEX_DTYPE(bits) \
|
||||
template <> struct builtin_complex_dtype< bits > { \
|
||||
static dtype get() { return DTYPE_FROM_CODE(NPY_COMPLEX ## bits); } \
|
||||
}; \
|
||||
template dtype get_complex_dtype< bits >()
|
||||
template <> struct builtin_complex_dtype<bits> \
|
||||
{ \
|
||||
static dtype get() { return DTYPE_FROM_CODE(NPY_COMPLEX ## bits);} \
|
||||
}; \
|
||||
template BOOST_NUMPY_DECL dtype get_complex_dtype<bits>()
|
||||
|
||||
namespace boost { namespace python { namespace converter {
|
||||
NUMPY_OBJECT_MANAGER_TRAITS_IMPL(PyArrayDescr_Type, numpy::dtype)
|
||||
@@ -58,7 +62,9 @@ BUILTIN_INT_DTYPE(8);
|
||||
BUILTIN_INT_DTYPE(16);
|
||||
BUILTIN_INT_DTYPE(32);
|
||||
BUILTIN_INT_DTYPE(64);
|
||||
#ifdef NPY_FLOAT16
|
||||
BUILTIN_FLOAT_DTYPE(16);
|
||||
#endif
|
||||
BUILTIN_FLOAT_DTYPE(32);
|
||||
BUILTIN_FLOAT_DTYPE(64);
|
||||
BUILTIN_COMPLEX_DTYPE(64);
|
||||
|
||||
@@ -22,20 +22,20 @@ namespace detail
|
||||
ndarray::bitflag numpy_to_bitflag(int const f)
|
||||
{
|
||||
ndarray::bitflag r = ndarray::NONE;
|
||||
if (f & NPY_C_CONTIGUOUS) r = (r | ndarray::C_CONTIGUOUS);
|
||||
if (f & NPY_F_CONTIGUOUS) r = (r | ndarray::F_CONTIGUOUS);
|
||||
if (f & NPY_ALIGNED) r = (r | ndarray::ALIGNED);
|
||||
if (f & NPY_WRITEABLE) r = (r | ndarray::WRITEABLE);
|
||||
if (f & NPY_ARRAY_C_CONTIGUOUS) r = (r | ndarray::C_CONTIGUOUS);
|
||||
if (f & NPY_ARRAY_F_CONTIGUOUS) r = (r | ndarray::F_CONTIGUOUS);
|
||||
if (f & NPY_ARRAY_ALIGNED) r = (r | ndarray::ALIGNED);
|
||||
if (f & NPY_ARRAY_WRITEABLE) r = (r | ndarray::WRITEABLE);
|
||||
return r;
|
||||
}
|
||||
|
||||
int bitflag_to_numpy(ndarray::bitflag f)
|
||||
{
|
||||
int r = 0;
|
||||
if (f & ndarray::C_CONTIGUOUS) r |= NPY_C_CONTIGUOUS;
|
||||
if (f & ndarray::F_CONTIGUOUS) r |= NPY_F_CONTIGUOUS;
|
||||
if (f & ndarray::ALIGNED) r |= NPY_ALIGNED;
|
||||
if (f & ndarray::WRITEABLE) r |= NPY_WRITEABLE;
|
||||
if (f & ndarray::C_CONTIGUOUS) r |= NPY_ARRAY_C_CONTIGUOUS;
|
||||
if (f & ndarray::F_CONTIGUOUS) r |= NPY_ARRAY_F_CONTIGUOUS;
|
||||
if (f & ndarray::ALIGNED) r |= NPY_ARRAY_ALIGNED;
|
||||
if (f & ndarray::WRITEABLE) r |= NPY_ARRAY_WRITEABLE;
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -119,10 +119,10 @@ ndarray from_data_impl(void * data,
|
||||
}
|
||||
int itemsize = dt.get_itemsize();
|
||||
int flags = 0;
|
||||
if (writeable) flags |= NPY_WRITEABLE;
|
||||
if (is_c_contiguous(shape, strides, itemsize)) flags |= NPY_C_CONTIGUOUS;
|
||||
if (is_f_contiguous(shape, strides, itemsize)) flags |= NPY_F_CONTIGUOUS;
|
||||
if (is_aligned(strides, itemsize)) flags |= NPY_ALIGNED;
|
||||
if (writeable) flags |= NPY_ARRAY_WRITEABLE;
|
||||
if (is_c_contiguous(shape, strides, itemsize)) flags |= NPY_ARRAY_C_CONTIGUOUS;
|
||||
if (is_f_contiguous(shape, strides, itemsize)) flags |= NPY_ARRAY_F_CONTIGUOUS;
|
||||
if (is_aligned(strides, itemsize)) flags |= NPY_ARRAY_ALIGNED;
|
||||
ndarray r(python::detail::new_reference
|
||||
(PyArray_NewFromDescr(&PyArray_Type,
|
||||
incref_dtype(dt),
|
||||
@@ -243,13 +243,13 @@ ndarray empty(int nd, Py_intptr_t const * shape, dtype const & dt)
|
||||
ndarray array(python::object const & obj)
|
||||
{
|
||||
return ndarray(python::detail::new_reference
|
||||
(PyArray_FromAny(obj.ptr(), NULL, 0, 0, NPY_ENSUREARRAY, NULL)));
|
||||
(PyArray_FromAny(obj.ptr(), NULL, 0, 0, NPY_ARRAY_ENSUREARRAY, NULL)));
|
||||
}
|
||||
|
||||
ndarray array(python::object const & obj, dtype const & dt)
|
||||
{
|
||||
return ndarray(python::detail::new_reference
|
||||
(PyArray_FromAny(obj.ptr(), detail::incref_dtype(dt), 0, 0, NPY_ENSUREARRAY, NULL)));
|
||||
(PyArray_FromAny(obj.ptr(), detail::incref_dtype(dt), 0, 0, NPY_ARRAY_ENSUREARRAY, NULL)));
|
||||
}
|
||||
|
||||
ndarray from_object(python::object const & obj, dtype const & dt, int nd_min, int nd_max, ndarray::bitflag flags)
|
||||
|
||||
@@ -115,7 +115,7 @@ bpl-test crossmod_exception
|
||||
[ bpl-test keywords : keywords.cpp keywords_test.py ]
|
||||
|
||||
|
||||
[ python-extension builtin_converters_ext : test_builtin_converters.cpp /boost/python//boost_python ]
|
||||
[ python-extension builtin_converters_ext : builtin_converters.cpp /boost/python//boost_python ]
|
||||
[ bpl-test builtin_converters : test_builtin_converters.py builtin_converters_ext ]
|
||||
|
||||
[ bpl-test test_pointer_adoption ]
|
||||
|
||||
@@ -116,7 +116,7 @@ else:
|
||||
test = env.BoostRunPythonScript('test_builtin_converters.py')
|
||||
Depends(
|
||||
test,
|
||||
env.PythonExtension('builtin_converters_ext', ['test_builtin_converters.cpp'])
|
||||
env.PythonExtension('builtin_converters_ext', ['builtin_converters.cpp'])
|
||||
)
|
||||
tests+=test
|
||||
test = env.BoostRunPythonScript('map_indexing_suite.py')
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#include <boost/python/bases.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/same_traits.hpp>
|
||||
#include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
struct A;
|
||||
struct B;
|
||||
@@ -42,8 +42,8 @@ int main()
|
||||
int
|
||||
, boost::python::detail::select_bases<char*>::type > collected1;
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<collected1::type,boost::python::bases<> >::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<choose_bases<int,char*,long>::type,boost::python::bases<> >::value));
|
||||
BOOST_STATIC_ASSERT((boost::python::detail::is_same<collected1::type,boost::python::bases<> >::value));
|
||||
BOOST_STATIC_ASSERT((boost::python::detail::is_same<choose_bases<int,char*,long>::type,boost::python::bases<> >::value));
|
||||
|
||||
typedef boost::python::detail::select_bases<
|
||||
int
|
||||
@@ -55,8 +55,8 @@ int main()
|
||||
>::type
|
||||
> collected2;
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<collected2::type,boost::python::bases<A,B> >::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<choose_bases<int,boost::python::bases<A,B>,long>::type,boost::python::bases<A,B> >::value));
|
||||
BOOST_STATIC_ASSERT((boost::python::detail::is_same<collected2::type,boost::python::bases<A,B> >::value));
|
||||
BOOST_STATIC_ASSERT((boost::python::detail::is_same<choose_bases<int,boost::python::bases<A,B>,long>::type,boost::python::bases<A,B> >::value));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: latin-1 -*-
|
||||
# Copyright Gottfried Ganßauge 2006.
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright Gottfried Ganßauge 2006.
|
||||
# Distributed under 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)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright Gottfried Ganßauge 2006.
|
||||
// Copyright Gottfried Ganßauge 2006.
|
||||
// Distributed under 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)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright Gottfried Ganßauge 2006.
|
||||
// Copyright Gottfried Ganßauge 2006.
|
||||
// Distributed under 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)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#if BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
||||
# include <boost/type_traits/is_enum.hpp>
|
||||
#include <boost/python/detail/type_traits.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
#endif
|
||||
using namespace boost::python;
|
||||
@@ -17,7 +17,7 @@ enum color { red = 1, green = 2, blue = 4, blood = 1 };
|
||||
#if BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
||||
namespace boost // Pro7 has a hard time detecting enums
|
||||
{
|
||||
template <> struct is_enum<color> : boost::mpl::true_ {};
|
||||
template <> struct boost::python::detail::is_enum<color> : boost::mpl::true_ {};
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/python/detail/if_else.hpp>
|
||||
#include <boost/type_traits/same_traits.hpp>
|
||||
#include <boost/python/detail/type_traits.hpp>
|
||||
|
||||
typedef char c1;
|
||||
typedef char c2[2];
|
||||
@@ -35,10 +35,10 @@ struct choose
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_STATIC_ASSERT((boost::is_same<choose<1>::type,c1>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<choose<2>::type,c2>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<choose<3>::type,c3>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<choose<4>::type,c4>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<choose<5>::type,void*>::value));
|
||||
BOOST_STATIC_ASSERT((boost::python::detail::is_same<choose<1>::type,c1>::value));
|
||||
BOOST_STATIC_ASSERT((boost::python::detail::is_same<choose<2>::type,c2>::value));
|
||||
BOOST_STATIC_ASSERT((boost::python::detail::is_same<choose<3>::type,c3>::value));
|
||||
BOOST_STATIC_ASSERT((boost::python::detail::is_same<choose<4>::type,c4>::value));
|
||||
BOOST_STATIC_ASSERT((boost::python::detail::is_same<choose<5>::type,void*>::value));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
//#include <stdio.h>
|
||||
#define BOOST_ENABLE_ASSERT_HANDLER
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/type_traits/is_member_function_pointer.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/python/detail/indirect_traits.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: latin-1 -*-
|
||||
# Copyright Gottfried Ganßauge 2003..2006. Distributed under the Boost
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright Gottfried Ganßauge 2003..2006. Distributed under 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)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#include <boost/python/pointee.hpp>
|
||||
#include <boost/type_traits/same_traits.hpp>
|
||||
#include <boost/python/detail/type_traits.hpp>
|
||||
#include <memory>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
@@ -13,19 +13,19 @@ struct A;
|
||||
int main()
|
||||
{
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<
|
||||
(boost::python::detail::is_same<
|
||||
boost::python::pointee<std::auto_ptr<char**> >::type
|
||||
, char**
|
||||
>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<
|
||||
(boost::python::detail::is_same<
|
||||
boost::python::pointee<boost::shared_ptr<A> >::type
|
||||
, A>::value));
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_same<
|
||||
(boost::python::detail::is_same<
|
||||
boost::python::pointee<char*>::type
|
||||
, char
|
||||
>::value));
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <boost/python/has_back_reference.hpp>
|
||||
#include <boost/python/detail/not_specified.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/same_traits.hpp>
|
||||
#include <boost/python/detail/type_traits.hpp>
|
||||
#include <boost/function/function0.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <memory>
|
||||
@@ -29,7 +29,7 @@ namespace boost { namespace python
|
||||
template <class T, class U>
|
||||
void assert_same(U* = 0, T* = 0)
|
||||
{
|
||||
BOOST_STATIC_ASSERT((boost::is_same<T,U>::value));
|
||||
BOOST_STATIC_ASSERT((boost::python::detail::is_same<T,U>::value));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
# Copyright David Abrahams 2004. Distributed under 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)
|
||||
import sys
|
||||
if (sys.version_info.major >= 3):
|
||||
long = int
|
||||
r"""
|
||||
>>> from builtin_converters_ext import *
|
||||
|
||||
@@ -74,7 +77,7 @@ False
|
||||
test unsigned long values which don't fit in a signed long.
|
||||
strip any 'L' characters in case the platform has > 32 bit longs
|
||||
|
||||
>>> hex(rewrap_value_unsigned_long(0x80000001L)).replace('L','')
|
||||
>>> hex(rewrap_value_unsigned_long(long(0x80000001))).replace('L','')
|
||||
'0x80000001'
|
||||
|
||||
>>> rewrap_value_long_long(42) == 42
|
||||
|
||||
Reference in New Issue
Block a user