Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2 config/cxx.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def add_options(vars):

def check(context):

source = r"""#if __cplusplus < 201103L
source = r"""#if __cplusplus < 201103L && (!defined(_MSC_VER) || _MSC_VER < 1800)
#error no C++11
#endif"""

Expand Down
2 changes: 1 addition & 1 deletion 2 include/boost/python/converter/registered.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace detail
registry::lookup_shared_ptr(type_id<shared_ptr<T> >());
}

#if __cplusplus >= 201103L
#if !defined(BOOST_NO_CXX11_SMART_PTR)
template <class T>
inline void
register_shared_ptr0(std::shared_ptr<T>*)
Expand Down
2 changes: 1 addition & 1 deletion 2 include/boost/python/converter/shared_ptr_to_python.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ PyObject* shared_ptr_to_python(shared_ptr<T> const& x)
return converter::registered<shared_ptr<T> const&>::converters.to_python(&x);
}

#if __cplusplus >= 201103L
#if !defined(BOOST_NO_CXX11_SMART_PTR)
template <class T>
PyObject* shared_ptr_to_python(std::shared_ptr<T> const& x)
{
Expand Down
2 changes: 1 addition & 1 deletion 2 include/boost/python/detail/caller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ inline PyObject* get(mpl::int_<N>, PyObject* const& args_)
return PyTuple_GET_ITEM(args_,N);
}

inline unsigned arity(PyObject* const& args_)
inline Py_ssize_t arity(PyObject* const& args_)
{
return PyTuple_GET_SIZE(args_);
}
Expand Down
2 changes: 1 addition & 1 deletion 2 include/boost/python/detail/is_shared_ptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace boost { namespace python { namespace detail {

BOOST_PYTHON_IS_XXX_DEF(shared_ptr, shared_ptr, 1)
#if __cplusplus >= 201103L
#if !defined(BOOST_NO_CXX11_SMART_PTR)
template <typename T>
struct is_shared_ptr<std::shared_ptr<T> > : std::true_type {};
#endif
Expand Down
5 changes: 3 additions & 2 deletions 5 include/boost/python/detail/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
# define BOOST_PYTHON_DETAIL_TYPE_TRAITS_HPP


#if __cplusplus < 201103L
#if __cplusplus < 201103L && (!defined(BOOST_MSVC) || BOOST_MSVC<=1600)
#define BOOST_PYTHON_USE_BOOST_TYPES
# include <boost/type_traits/transform_traits.hpp>
# include <boost/type_traits/same_traits.hpp>
# include <boost/type_traits/cv_traits.hpp>
Expand All @@ -34,7 +35,7 @@

namespace boost { namespace python { namespace detail {

#if __cplusplus < 201103L
#if defined(BOOST_PYTHON_USE_BOOST_TYPES)
using boost::alignment_of;
using boost::add_const;
using boost::add_cv;
Expand Down
4 changes: 2 additions & 2 deletions 4 include/boost/python/make_constructor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace detail
template <class U>
void dispatch(U* x, detail::true_) const
{
#if __cplusplus < 201103L
#if defined(BOOST_NO_CXX11_SMART_PTR)
std::auto_ptr<U> owner(x);
dispatch(owner, detail::false_());
#else
Expand All @@ -63,7 +63,7 @@ namespace detail

void* memory = holder::allocate(this->m_self, offsetof(instance_t, storage), sizeof(holder));
try {
#if __cplusplus < 201103L
#if defined(BOOST_NO_CXX11_SMART_PTR)
(new (memory) holder(x))->install(this->m_self);
#else
(new (memory) holder(std::move(x)))->install(this->m_self);
Expand Down
22 changes: 3 additions & 19 deletions 22 include/boost/python/module_init.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,9 @@ BOOST_PYTHON_DECL PyObject* init_module(char const* name, void(*)());

# endif

# if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(BOOST_PYTHON_STATIC_MODULE)

# define BOOST_PYTHON_MODULE_INIT(name) \
void BOOST_PP_CAT(init_module_,name)(); \
extern "C" __declspec(dllexport) _BOOST_PYTHON_MODULE_INIT(name)

# elif BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY

# define BOOST_PYTHON_MODULE_INIT(name) \
void BOOST_PP_CAT(init_module_,name)(); \
extern "C" __attribute__ ((__visibility__("default"))) _BOOST_PYTHON_MODULE_INIT(name)

# else

# define BOOST_PYTHON_MODULE_INIT(name) \
void BOOST_PP_CAT(init_module_,name)(); \
extern "C" _BOOST_PYTHON_MODULE_INIT(name)

# endif
# define BOOST_PYTHON_MODULE_INIT(name) \
void BOOST_PP_CAT(init_module_,name)(); \
extern "C" BOOST_SYMBOL_EXPORT _BOOST_PYTHON_MODULE_INIT(name)

# endif

Expand Down
2 changes: 1 addition & 1 deletion 2 include/boost/python/object/class_metadata.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ inline void register_shared_ptr_from_python_and_casts(T*, Bases)
{
// Constructor performs registration
python::detail::force_instantiate(converter::shared_ptr_from_python<T, boost::shared_ptr>());
#if __cplusplus >= 201103L
#if !defined(BOOST_NO_CXX11_SMART_PTR)
python::detail::force_instantiate(converter::shared_ptr_from_python<T, std::shared_ptr>());
#endif

Expand Down
4 changes: 2 additions & 2 deletions 4 include/boost/python/object/make_ptr_instance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct make_ptr_instance
template <class Arg>
static inline Holder* construct(void* storage, PyObject*, Arg& x)
{
#if __cplusplus < 201103L
#if defined(BOOST_NO_CXX11_SMART_PTR)
return new (storage) Holder(x);
#else
return new (storage) Holder(std::move(x));
Expand Down Expand Up @@ -58,7 +58,7 @@ struct make_ptr_instance
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)))
type_info(typeid(*x))
);
return r ? r->m_class_object : 0;
}
Expand Down
4 changes: 2 additions & 2 deletions 4 include/boost/python/object/pointer_holder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ struct pointer_holder_back_reference : instance_holder

template <class Pointer, class Value>
inline pointer_holder<Pointer,Value>::pointer_holder(Pointer p)
#if __cplusplus < 201103L
#if defined(BOOST_NO_CXX11_SMART_PTR)
: m_p(p)
#else
: m_p(std::move(p))
Expand All @@ -116,7 +116,7 @@ inline pointer_holder<Pointer,Value>::pointer_holder(Pointer p)

template <class Pointer, class Value>
inline pointer_holder_back_reference<Pointer,Value>::pointer_holder_back_reference(Pointer p)
#if __cplusplus < 201103L
#if defined(BOOST_NO_CXX11_SMART_PTR)
: m_p(p)
#else
: m_p(std::move(p))
Expand Down
4 changes: 2 additions & 2 deletions 4 include/boost/python/object/py_function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ struct py_function
{}

py_function(py_function const& rhs)
#if __cplusplus < 201103L
#if defined(BOOST_NO_CXX11_SMART_PTR)
: m_impl(rhs.m_impl)
#else
: m_impl(std::move(rhs.m_impl))
Expand Down Expand Up @@ -168,7 +168,7 @@ struct py_function
}

private:
#if __cplusplus < 201103L
#if defined(BOOST_NO_CXX11_SMART_PTR)
mutable std::auto_ptr<py_function_impl_base> m_impl;
#else
mutable std::unique_ptr<py_function_impl_base> m_impl;
Expand Down
18 changes: 4 additions & 14 deletions 18 include/boost/python/signature.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,13 @@ struct most_derived
// 'default' calling convention

# define BOOST_PYTHON_FN_CC
# define BOOST_PYTHON_FN_CC_IS_DEFAULT

# define BOOST_PP_ITERATION_PARAMS_1 \
(3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/signature.hpp>))

# include BOOST_PP_ITERATE()

# undef BOOST_PYTHON_FN_CC
# undef BOOST_PYTHON_FN_CC_IS_DEFAULT

// __cdecl calling convention

Expand All @@ -143,15 +141,13 @@ struct most_derived
# if defined(BOOST_PYTHON_ENABLE_STDCALL)

# define BOOST_PYTHON_FN_CC __stdcall
# define BOOST_PYTHON_FN_CC_IS_STDCALL

# define BOOST_PP_ITERATION_PARAMS_1 \
(3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/signature.hpp>))

# include BOOST_PP_ITERATE()

# undef BOOST_PYTHON_FN_CC
# undef BOOST_PYTHON_FN_CC_IS_STDCALL

# endif // defined(BOOST_PYTHON_ENABLE_STDCALL)

Expand All @@ -160,14 +156,12 @@ struct most_derived
# if defined(BOOST_PYTHON_ENABLE_FASTCALL)

# define BOOST_PYTHON_FN_CC __fastcall
# define BOOST_PYTHON_FN_CC_IS_FASTCALL

# define BOOST_PP_ITERATION_PARAMS_1 \
(3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/signature.hpp>))

# include BOOST_PP_ITERATE()

# undef BOOST_PYTHON_FN_CC_IS_FASTCALL
# undef BOOST_PYTHON_FN_CC

# endif // defined(BOOST_PYTHON_ENABLE_FASTCALL)
Expand All @@ -190,8 +184,8 @@ struct most_derived

// as 'get_signature(RT(*)(T0...TN), void* = 0)' is the same
// function as 'get_signature(RT(__cdecl *)(T0...TN), void* = 0)',
// we don't define it multiple times (i.e. for __cdecl, __stdcall ...)
# if defined(BOOST_PYTHON_FN_CC_IS_DEFAULT)
// we don't define it twice
# if !defined(BOOST_PYTHON_FN_CC_IS_CDECL)

template <
class RT BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class T)>
Expand All @@ -204,21 +198,19 @@ get_signature(RT(BOOST_PYTHON_FN_CC *)(BOOST_PP_ENUM_PARAMS_Z(1, N, T)), void* =
>();
}

# endif // BOOST_PYTHON_FN_CC_IS_DEFAULT
# endif // !defined(BOOST_PYTHON_FN_CC_IS_CDECL)

# undef N

# define BOOST_PP_ITERATION_PARAMS_2 \
(3, (0, 3, <boost/python/signature.hpp>))
# include BOOST_PP_ITERATE()

#else // BOOST_PP_ITERATION_DEPTH() != 1
#else

# define N BOOST_PP_RELATIVE_ITERATION(1)
# define Q BOOST_PYTHON_CV_QUALIFIER(BOOST_PP_ITERATION())

# if defined(BOOST_PYTHON_FN_CC_IS_DEFAULT)

template <
class RT, class ClassT BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class T)>
inline BOOST_PYTHON_LIST_INC(BOOST_PP_INC(N))<
Expand Down Expand Up @@ -253,8 +245,6 @@ get_signature(
>();
}

# endif // BOOST_PYTHON_FN_CC_IS_DEFAULT

# undef Q
# undef N

Expand Down
2 changes: 1 addition & 1 deletion 2 include/boost/python/to_python_indirect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace detail
// copy constructor.
# if defined(__ICL) && __ICL < 600
typedef boost::shared_ptr<T> smart_pointer;
# elif __cplusplus < 201103L
# elif defined(BOOST_NO_CXX11_SMART_PTR)
typedef std::auto_ptr<T> smart_pointer;
# else
typedef std::unique_ptr<T> smart_pointer;
Expand Down
2 changes: 1 addition & 1 deletion 2 include/boost/python/to_python_value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ struct object_manager_get_pytype<true>
PyTypeObject const* get_pytype(boost::type<shared_ptr<U> &> *) const {return converter::registered<U>::converters.to_python_target_type();}
template <class U>
PyTypeObject const* get_pytype(boost::type<const shared_ptr<U> &> *) const {return converter::registered<U>::converters.to_python_target_type();}
# if __cplusplus >= 201103L
# if !defined(BOOST_NO_CXX11_SMART_PTR)
template <class U>
PyTypeObject const* get_pytype(boost::type<std::shared_ptr<U> &> *) const {return converter::registered<U>::converters.to_python_target_type();}
template <class U>
Expand Down
12 changes: 9 additions & 3 deletions 12 src/object/enum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,17 @@ static PyMemberDef enum_members[] = {

extern "C"
{
static void
enum_dealloc(enum_object* self)
{
Py_XDECREF(self->name);
Py_TYPE(self)->tp_free((PyObject*)self);
}

static PyObject* enum_repr(PyObject* self_)
{
// XXX(bhy) Potentional memory leak here since PyObject_GetAttrString returns a new reference
// const char *mod = PyString_AsString(PyObject_GetAttrString( self_, const_cast<char*>("__module__")));
PyObject *mod = PyObject_GetAttrString( self_, "__module__");
object auto_free(handle<>(mod));
enum_object* self = downcast<enum_object>(self_);
if (!self->name)
{
Expand Down Expand Up @@ -88,7 +94,7 @@ static PyTypeObject enum_type_object = {
const_cast<char*>("Boost.Python.enum"),
sizeof(enum_object), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
(destructor) enum_dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.