aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/boost/python
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2022-09-17 22:03:44 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2022-09-17 22:03:44 +0300
commit49726f2627f20969d8e6358fc107bdf139c87f99 (patch)
treef94d610e293cb577fbf973b1d0ac07c005c948d0 /contrib/restricted/boost/python
parente4065899cddff8a7bde3bc774f33e9b6bebd961c (diff)
downloadydb-49726f2627f20969d8e6358fc107bdf139c87f99.tar.gz
Update contrib/restricted/boost/interprocess to 1.80.0
Diffstat (limited to 'contrib/restricted/boost/python')
-rw-r--r--contrib/restricted/boost/python/README.md4
-rw-r--r--contrib/restricted/boost/python/include/boost/python/call.hpp4
-rw-r--r--contrib/restricted/boost/python/include/boost/python/call_method.hpp2
-rw-r--r--contrib/restricted/boost/python/include/boost/python/def_visitor.hpp4
-rw-r--r--contrib/restricted/boost/python/include/boost/python/detail/caller.hpp31
-rw-r--r--contrib/restricted/boost/python/include/boost/python/detail/config.hpp7
-rw-r--r--contrib/restricted/boost/python/include/boost/python/detail/wrap_python.hpp40
-rw-r--r--contrib/restricted/boost/python/include/boost/python/list.hpp2
-rw-r--r--contrib/restricted/boost/python/include/boost/python/long.hpp4
-rw-r--r--contrib/restricted/boost/python/include/boost/python/object/iterator.hpp4
-rw-r--r--contrib/restricted/boost/python/include/boost/python/object/make_instance.hpp2
-rw-r--r--contrib/restricted/boost/python/include/boost/python/other.hpp8
-rw-r--r--contrib/restricted/boost/python/include/boost/python/override.hpp4
-rw-r--r--contrib/restricted/boost/python/include/boost/python/ptr.hpp8
-rw-r--r--contrib/restricted/boost/python/src/exec.cpp4
-rw-r--r--contrib/restricted/boost/python/src/long.cpp8
-rw-r--r--contrib/restricted/boost/python/src/module.cpp2
-rw-r--r--contrib/restricted/boost/python/src/object/class.cpp19
-rw-r--r--contrib/restricted/boost/python/src/object/enum.cpp2
-rw-r--r--contrib/restricted/boost/python/src/object/function.cpp7
-rw-r--r--contrib/restricted/boost/python/src/object/life_support.cpp2
-rw-r--r--contrib/restricted/boost/python/src/wrapper.cpp4
22 files changed, 108 insertions, 64 deletions
diff --git a/contrib/restricted/boost/python/README.md b/contrib/restricted/boost/python/README.md
index c692bb8a66..f57b97505a 100644
--- a/contrib/restricted/boost/python/README.md
+++ b/contrib/restricted/boost/python/README.md
@@ -2,6 +2,8 @@
# Synopsis
+[![Join the chat at https://gitter.im/boostorg/python](https://badges.gitter.im/boostorg/python.svg)](https://gitter.im/boostorg/python?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
Welcome to Boost.Python, a C++ library which enables seamless interoperability between C++ and the Python programming language. The library includes support for:
* References and Pointers
@@ -19,7 +21,7 @@ See the [Boost.Python](http://boostorg.github.io/python) documentation for detai
**Hint :** Check out the [development version](http://boostorg.github.io/python/develop) of the documentation to see work in progress.
-# Building ![Build Status](https://travis-ci.org/boostorg/python.svg?branch=develop)
+# Building ![Test Ubuntu](https://github.com/boostorg/python/workflows/Test%20Ubuntu/badge.svg) ![Test OSX](https://github.com/boostorg/python/workflows/Test%20OSX/badge.svg) ![Test Windows](https://github.com/boostorg/python/workflows/Test%20Windows/badge.svg)
While Boost.Python is part of the Boost C++ Libraries super-project, and thus can be compiled as part of Boost, it can also be compiled and installed stand-alone, i.e. against a pre-installed Boost package.
diff --git a/contrib/restricted/boost/python/include/boost/python/call.hpp b/contrib/restricted/boost/python/include/boost/python/call.hpp
index 5d2d7d2341..c057ee9a12 100644
--- a/contrib/restricted/boost/python/include/boost/python/call.hpp
+++ b/contrib/restricted/boost/python/include/boost/python/call.hpp
@@ -60,7 +60,7 @@ call(PyObject* callable
)
{
PyObject* const result =
- PyEval_CallFunction(
+ PyObject_CallFunction(
callable
, const_cast<char*>("(" BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_FIXED, "O") ")")
BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_FAST_ARG_TO_PYTHON_GET, nil)
@@ -69,7 +69,7 @@ call(PyObject* callable
// This conversion *must not* be done in the same expression as
// the call, because, in the special case where the result is a
// reference a Python object which was created by converting a C++
- // argument for passing to PyEval_CallFunction, its reference
+ // argument for passing to PyObject_CallFunction, its reference
// count will be 2 until the end of the full expression containing
// the conversion, and that interferes with dangling
// pointer/reference detection.
diff --git a/contrib/restricted/boost/python/include/boost/python/call_method.hpp b/contrib/restricted/boost/python/include/boost/python/call_method.hpp
index 410f66820e..424077eab4 100644
--- a/contrib/restricted/boost/python/include/boost/python/call_method.hpp
+++ b/contrib/restricted/boost/python/include/boost/python/call_method.hpp
@@ -69,7 +69,7 @@ call_method(PyObject* self, char const* name
// This conversion *must not* be done in the same expression as
// the call, because, in the special case where the result is a
// reference a Python object which was created by converting a C++
- // argument for passing to PyEval_CallFunction, its reference
+ // argument for passing to PyObject_CallFunction, its reference
// count will be 2 until the end of the full expression containing
// the conversion, and that interferes with dangling
// pointer/reference detection.
diff --git a/contrib/restricted/boost/python/include/boost/python/def_visitor.hpp b/contrib/restricted/boost/python/include/boost/python/def_visitor.hpp
index 9c8907cd6f..18dd928684 100644
--- a/contrib/restricted/boost/python/include/boost/python/def_visitor.hpp
+++ b/contrib/restricted/boost/python/include/boost/python/def_visitor.hpp
@@ -16,7 +16,7 @@ template <class T, class X1, class X2, class X3> class class_;
class def_visitor_access
{
# if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) \
- || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+ || BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551))
// Tasteless as this may seem, making all members public allows member templates
// to work in the absence of member template friends.
public:
@@ -52,7 +52,7 @@ class def_visitor
friend class def_visitor_access;
# if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) \
- || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+ || BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551))
// Tasteless as this may seem, making all members public allows member templates
// to work in the absence of member template friends.
public:
diff --git a/contrib/restricted/boost/python/include/boost/python/detail/caller.hpp b/contrib/restricted/boost/python/include/boost/python/detail/caller.hpp
index 1bd30bfb5a..2834d6da99 100644
--- a/contrib/restricted/boost/python/include/boost/python/detail/caller.hpp
+++ b/contrib/restricted/boost/python/include/boost/python/detail/caller.hpp
@@ -109,6 +109,23 @@ struct converter_target_type <void_result_to_python >
return 0;
}
};
+
+// Generation of ret moved from caller_arity<N>::impl::signature to here due to "feature" in MSVC 15.7.2 with /O2
+// which left the ret uninitialized and caused segfaults in Python interpreter.
+template<class Policies, class Sig> const signature_element* get_ret()
+{
+ typedef BOOST_DEDUCED_TYPENAME Policies::template extract_return_type<Sig>::type rtype;
+ typedef typename select_result_converter<Policies, rtype>::type result_converter;
+
+ static const signature_element ret = {
+ (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
+ };
+
+ return &ret;
+}
+
#endif
@@ -229,16 +246,12 @@ struct caller_arity<N>
{
const signature_element * sig = detail::signature<Sig>::elements();
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
+ // MSVC 15.7.2, when compiling to /O2 left the static const signature_element ret,
+ // originally defined here, uninitialized. This in turn led to SegFault in Python interpreter.
+ // Issue is resolved by moving the generation of ret to separate function in detail namespace (see above).
+ const signature_element * ret = detail::get_ret<Policies, Sig>();
- typedef BOOST_DEDUCED_TYPENAME Policies::template extract_return_type<Sig>::type rtype;
- typedef typename select_result_converter<Policies, rtype>::type result_converter;
-
- static const signature_element ret = {
- (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
- };
- py_func_sig_info res = {sig, &ret };
+ py_func_sig_info res = {sig, ret };
#else
py_func_sig_info res = {sig, sig };
#endif
diff --git a/contrib/restricted/boost/python/include/boost/python/detail/config.hpp b/contrib/restricted/boost/python/include/boost/python/detail/config.hpp
index acf588311f..8dce9b742e 100644
--- a/contrib/restricted/boost/python/include/boost/python/detail/config.hpp
+++ b/contrib/restricted/boost/python/include/boost/python/detail/config.hpp
@@ -105,7 +105,9 @@
// 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##PY_MAJOR_VERSION##PY_MINOR_VERSION
+#define _BOOST_PYTHON_CONCAT(N, M, m) N ## M ## m
+#define BOOST_PYTHON_CONCAT(N, M, m) _BOOST_PYTHON_CONCAT(N, M, m)
+#define BOOST_LIB_NAME BOOST_PYTHON_CONCAT(boost_python, PY_MAJOR_VERSION, PY_MINOR_VERSION)
//
// If we're importing code from a dll, then tell auto_link.hpp about it:
//
@@ -118,6 +120,9 @@
#include <boost/config/auto_link.hpp>
#endif // auto-linking disabled
+#undef BOOST_PYTHON_CONCAT
+#undef _BOOST_PYTHON_CONCAT
+
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
#define BOOST_PYTHON_SUPPORTS_PY_SIGNATURES // enables smooth transition
#endif
diff --git a/contrib/restricted/boost/python/include/boost/python/detail/wrap_python.hpp b/contrib/restricted/boost/python/include/boost/python/detail/wrap_python.hpp
index 9fdb222c68..037e4bf2ec 100644
--- a/contrib/restricted/boost/python/include/boost/python/detail/wrap_python.hpp
+++ b/contrib/restricted/boost/python/include/boost/python/detail/wrap_python.hpp
@@ -47,6 +47,13 @@
# endif
#endif
+// pyconfig.h defines a macro with hypot name, what breaks libstdc++ math headers
+// that Python.h tries to include afterwards.
+#if defined(__MINGW32__)
+# include <cmath>
+# include <math.h>
+#endif
+
# include <pyconfig.h>
# if defined(_SGI_COMPILER_VERSION) && _SGI_COMPILER_VERSION >= 740
# undef _POSIX_C_SOURCE
@@ -83,6 +90,7 @@
// than MSVC on Win32
//
#if defined(_WIN32) || defined(__CYGWIN__)
+
# if defined(__GNUC__) && defined(__CYGWIN__)
# if defined(__LP64__)
@@ -138,19 +146,45 @@ typedef int pid_t;
# undef hypot // undo the evil #define left by Python.
-# elif defined(__BORLANDC__)
+# elif defined(__BORLANDC__) && !defined(__clang__)
# undef HAVE_HYPOT
# define HAVE_HYPOT 1
# endif
#endif // _WIN32
+#if defined(__GNUC__)
+# if defined(__has_warning)
+# define BOOST_PYTHON_GCC_HAS_WREGISTER __has_warning("-Wregister")
+# else
+# define BOOST_PYTHON_GCC_HAS_WREGISTER __GNUC__ >= 7
+# endif
+#else
+# define BOOST_PYTHON_GCC_HAS_WREGISTER 0
+#endif
+
+// Python.h header uses `register` keyword until Python 3.4
+#if BOOST_PYTHON_GCC_HAS_WREGISTER
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wregister"
+#elif defined(_MSC_VER)
+# pragma warning(push)
+# pragma warning(disable : 5033) // 'register' is no longer a supported storage class
+#endif
+
#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 2 && PY_MICRO_VERSION < 2
# include <boost/python/detail/python22_fixed.h>
#else
# include <Python.h>
#endif
+#if BOOST_PYTHON_GCC_HAS_WREGISTER
+# pragma GCC diagnostic pop
+#elif defined(_MSC_VER)
+# pragma warning(pop)
+#endif
+#undef BOOST_PYTHON_GCC_HAS_WREGISTER
+
#ifdef BOOST_PYTHON_ULONG_MAX_UNDEFINED
# undef ULONG_MAX
# undef BOOST_PYTHON_ULONG_MAX_UNDEFINED
@@ -193,7 +227,11 @@ typedef int pid_t;
# define PyVarObject_HEAD_INIT(type, size) \
PyObject_HEAD_INIT(type) size,
+#endif
+#if PY_VERSION_HEX < 0x030900A4
+# define Py_SET_TYPE(obj, type) ((Py_TYPE(obj) = (type)), (void)0)
+# define Py_SET_SIZE(obj, size) ((Py_SIZE(obj) = (size)), (void)0)
#endif
diff --git a/contrib/restricted/boost/python/include/boost/python/list.hpp b/contrib/restricted/boost/python/include/boost/python/list.hpp
index 10fd40fda5..0d5e2c8fd9 100644
--- a/contrib/restricted/boost/python/include/boost/python/list.hpp
+++ b/contrib/restricted/boost/python/include/boost/python/list.hpp
@@ -73,7 +73,7 @@ class list : public detail::list_base
}
template <class T>
- long count(T const& value) const
+ ssize_t count(T const& value) const
{
return base::count(object(value));
}
diff --git a/contrib/restricted/boost/python/include/boost/python/long.hpp b/contrib/restricted/boost/python/include/boost/python/long.hpp
index 129c61f9e4..c15604c91c 100644
--- a/contrib/restricted/boost/python/include/boost/python/long.hpp
+++ b/contrib/restricted/boost/python/include/boost/python/long.hpp
@@ -24,8 +24,8 @@ namespace detail
BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(long_base, object)
private:
- static detail::new_non_null_reference call(object const&);
- static detail::new_non_null_reference call(object const&, object const&);
+ static detail::new_reference call(object const&);
+ static detail::new_reference call(object const&, object const&);
};
}
diff --git a/contrib/restricted/boost/python/include/boost/python/object/iterator.hpp b/contrib/restricted/boost/python/include/boost/python/object/iterator.hpp
index e2f65721fb..874950365d 100644
--- a/contrib/restricted/boost/python/include/boost/python/object/iterator.hpp
+++ b/contrib/restricted/boost/python/include/boost/python/object/iterator.hpp
@@ -25,7 +25,7 @@
# include <boost/type.hpp>
-# include <boost/detail/iterator.hpp>
+# include <iterator>
namespace boost { namespace python { namespace objects {
@@ -42,7 +42,7 @@ struct iterator_range
{
iterator_range(object sequence, Iterator start, Iterator finish);
- typedef boost::detail::iterator_traits<Iterator> traits_t;
+ typedef std::iterator_traits<Iterator> traits_t;
struct next
{
diff --git a/contrib/restricted/boost/python/include/boost/python/object/make_instance.hpp b/contrib/restricted/boost/python/include/boost/python/object/make_instance.hpp
index 31ec08f7c3..5eb3aa9d9c 100644
--- a/contrib/restricted/boost/python/include/boost/python/object/make_instance.hpp
+++ b/contrib/restricted/boost/python/include/boost/python/object/make_instance.hpp
@@ -47,7 +47,7 @@ struct make_instance_impl
// Note the position of the internally-stored Holder,
// for the sake of destruction
- Py_SIZE(instance) = offsetof(instance_t, storage);
+ Py_SET_SIZE(instance, offsetof(instance_t, storage));
// Release ownership of the python object
protect.cancel();
diff --git a/contrib/restricted/boost/python/include/boost/python/other.hpp b/contrib/restricted/boost/python/include/boost/python/other.hpp
index 24a24ad8d1..26ebb426ba 100644
--- a/contrib/restricted/boost/python/include/boost/python/other.hpp
+++ b/contrib/restricted/boost/python/include/boost/python/other.hpp
@@ -1,5 +1,5 @@
-#ifndef OTHER_DWA20020601_HPP
-# define OTHER_DWA20020601_HPP
+#ifndef BOOST_PYTHON_OTHER_HPP
+# define BOOST_PYTHON_OTHER_HPP
# include <boost/python/detail/prefix.hpp>
// Copyright David Abrahams 2002.
@@ -7,8 +7,6 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-# pragma once
-
# include <boost/config.hpp>
namespace boost { namespace python {
@@ -51,4 +49,4 @@ namespace detail
}} // namespace boost::python
-#endif // #ifndef OTHER_DWA20020601_HPP
+#endif
diff --git a/contrib/restricted/boost/python/include/boost/python/override.hpp b/contrib/restricted/boost/python/include/boost/python/override.hpp
index 39714257f9..b631226fd6 100644
--- a/contrib/restricted/boost/python/include/boost/python/override.hpp
+++ b/contrib/restricted/boost/python/include/boost/python/override.hpp
@@ -97,7 +97,7 @@ class override : public object
operator()() const
{
detail::method_result x(
- PyEval_CallFunction(
+ PyObject_CallFunction(
this->ptr()
, const_cast<char*>("()")
));
@@ -132,7 +132,7 @@ detail::method_result
operator()( BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, const& a) ) const
{
detail::method_result x(
- PyEval_CallFunction(
+ PyObject_CallFunction(
this->ptr()
, const_cast<char*>("(" BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_FIXED, "O") ")")
BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_fast_arg_to_python_get, nil)
diff --git a/contrib/restricted/boost/python/include/boost/python/ptr.hpp b/contrib/restricted/boost/python/include/boost/python/ptr.hpp
index 287daba458..8e97aa4064 100644
--- a/contrib/restricted/boost/python/include/boost/python/ptr.hpp
+++ b/contrib/restricted/boost/python/include/boost/python/ptr.hpp
@@ -1,5 +1,5 @@
-#ifndef PTR_DWA20020601_HPP
-# define PTR_DWA20020601_HPP
+#ifndef BOOST_PYTHON_PTR_HPP
+# define BOOST_PYTHON_PTR_HPP
# include <boost/python/detail/prefix.hpp>
// Copyright David Abrahams 2002.
@@ -11,8 +11,6 @@
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2001 Peter Dimov
-# pragma once
-
# include <boost/config.hpp>
# include <boost/mpl/bool.hpp>
@@ -64,4 +62,4 @@ class unwrap_pointer<pointer_wrapper<T> >
}} // namespace boost::python
-#endif // #ifndef PTR_DWA20020601_HPP
+#endif
diff --git a/contrib/restricted/boost/python/src/exec.cpp b/contrib/restricted/boost/python/src/exec.cpp
index 5193b04745..8bc8be996b 100644
--- a/contrib/restricted/boost/python/src/exec.cpp
+++ b/contrib/restricted/boost/python/src/exec.cpp
@@ -116,7 +116,7 @@ object BOOST_PYTHON_DECL exec_file(char const *filename, object global, object l
#elif PY_VERSION_HEX >= 0x03000000
// Let python open the file to avoid potential binary incompatibilities.
PyObject *fo = Py_BuildValue("s", f);
- FILE *fs = _Py_fopen(fo, "r"); // Private CPython API
+ FILE *fs = fopen(fo, "r");
Py_DECREF(fo);
#else
// Let python open the file to avoid potential binary incompatibilities.
@@ -128,7 +128,7 @@ object BOOST_PYTHON_DECL exec_file(char const *filename, object global, object l
PyObject* result = PyRun_File(fs,
f,
Py_file_input,
- global.ptr(), local.ptr());
+ global.ptr(), local.ptr());
if (!result) throw_error_already_set();
return object(detail::new_reference(result));
}
diff --git a/contrib/restricted/boost/python/src/long.cpp b/contrib/restricted/boost/python/src/long.cpp
index 1ec8ebc011..6aa2965e83 100644
--- a/contrib/restricted/boost/python/src/long.cpp
+++ b/contrib/restricted/boost/python/src/long.cpp
@@ -6,16 +6,16 @@
namespace boost { namespace python { namespace detail {
-new_non_null_reference long_base::call(object const& arg_)
+new_reference long_base::call(object const& arg_)
{
- return (detail::new_non_null_reference)PyObject_CallFunction(
+ return (detail::new_reference)PyObject_CallFunction(
(PyObject*)&PyLong_Type, const_cast<char*>("(O)"),
arg_.ptr());
}
-new_non_null_reference long_base::call(object const& arg_, object const& base)
+new_reference long_base::call(object const& arg_, object const& base)
{
- return (detail::new_non_null_reference)PyObject_CallFunction(
+ return (detail::new_reference)PyObject_CallFunction(
(PyObject*)&PyLong_Type, const_cast<char*>("(OO)"),
arg_.ptr(), base.ptr());
}
diff --git a/contrib/restricted/boost/python/src/module.cpp b/contrib/restricted/boost/python/src/module.cpp
index 9628481996..57675fa2df 100644
--- a/contrib/restricted/boost/python/src/module.cpp
+++ b/contrib/restricted/boost/python/src/module.cpp
@@ -21,7 +21,7 @@ namespace
object m_obj(((borrowed_reference_t*)m));
scope current_module(m_obj);
- handle_exception(init_function);
+ if (handle_exception(init_function)) return NULL;
}
return m;
diff --git a/contrib/restricted/boost/python/src/object/class.cpp b/contrib/restricted/boost/python/src/object/class.cpp
index 8d0daf63d7..9f8dc61ad1 100644
--- a/contrib/restricted/boost/python/src/object/class.cpp
+++ b/contrib/restricted/boost/python/src/object/class.cpp
@@ -208,7 +208,7 @@ namespace objects
{
if (static_data_object.tp_dict == 0)
{
- Py_TYPE(&static_data_object) = &PyType_Type;
+ Py_SET_TYPE(&static_data_object, &PyType_Type);
static_data_object.tp_base = &PyProperty_Type;
if (PyType_Ready(&static_data_object))
return 0;
@@ -316,7 +316,7 @@ namespace objects
{
if (class_metatype_object.tp_dict == 0)
{
- Py_TYPE(&class_metatype_object) = &PyType_Type;
+ Py_SET_TYPE(&class_metatype_object, &PyType_Type);
class_metatype_object.tp_base = &PyType_Type;
if (PyType_Ready(&class_metatype_object))
return type_handle();
@@ -374,12 +374,7 @@ namespace objects
// like, so we'll store the total size of the object
// there. A negative number indicates that the extra
// instance memory is not yet allocated to any holders.
-#if PY_VERSION_HEX >= 0x02060000
- Py_SIZE(result) =
-#else
- result->ob_size =
-#endif
- -(static_cast<int>(offsetof(instance<>,storage) + instance_size));
+ Py_SET_SIZE(result,-static_cast<int>(offsetof(instance<>,storage) + instance_size));
}
return (PyObject*)result;
}
@@ -470,7 +465,7 @@ namespace objects
{
if (class_type_object.tp_dict == 0)
{
- Py_TYPE(&class_type_object) = incref(class_metatype().get());
+ Py_SET_TYPE(&class_type_object, incref(class_metatype().get()));
class_type_object.tp_base = &PyBaseObject_Type;
if (PyType_Ready(&class_type_object))
return type_handle();
@@ -618,7 +613,7 @@ namespace objects
{
object property(
(python::detail::new_reference)
- PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast<char*>("Osss"), fget.ptr(), 0, 0, docstr));
+ PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast<char*>("Osss"), fget.ptr(), (char*)NULL, (char*)NULL, docstr));
this->setattr(name, property);
}
@@ -628,7 +623,7 @@ namespace objects
{
object property(
(python::detail::new_reference)
- PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast<char*>("OOss"), fget.ptr(), fset.ptr(), 0, docstr));
+ PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast<char*>("OOss"), fget.ptr(), fset.ptr(), (char*)NULL, docstr));
this->setattr(name, property);
}
@@ -739,7 +734,7 @@ void* instance_holder::allocate(PyObject* self_, std::size_t holder_offset, std:
assert(holder_offset >= offsetof(objects::instance<>,storage));
// Record the fact that the storage is occupied, noting where it starts
- Py_SIZE(self) = holder_offset;
+ Py_SET_SIZE(self, holder_offset);
return (char*)self + holder_offset;
}
else
diff --git a/contrib/restricted/boost/python/src/object/enum.cpp b/contrib/restricted/boost/python/src/object/enum.cpp
index 10122ad1da..293e705899 100644
--- a/contrib/restricted/boost/python/src/object/enum.cpp
+++ b/contrib/restricted/boost/python/src/object/enum.cpp
@@ -153,7 +153,7 @@ namespace
{
if (enum_type_object.tp_dict == 0)
{
- Py_TYPE(&enum_type_object) = incref(&PyType_Type);
+ Py_SET_TYPE(&enum_type_object, incref(&PyType_Type));
#if PY_VERSION_HEX >= 0x03000000
enum_type_object.tp_base = &PyLong_Type;
#else
diff --git a/contrib/restricted/boost/python/src/object/function.cpp b/contrib/restricted/boost/python/src/object/function.cpp
index e15eb3ffc0..787679e138 100644
--- a/contrib/restricted/boost/python/src/object/function.cpp
+++ b/contrib/restricted/boost/python/src/object/function.cpp
@@ -107,7 +107,7 @@ function::function(
PyObject* p = this;
if (Py_TYPE(&function_type) == 0)
{
- Py_TYPE(&function_type) = &PyType_Type;
+ Py_SET_TYPE(&function_type, &PyType_Type);
::PyType_Ready(&function_type);
}
@@ -158,11 +158,6 @@ PyObject* function::call(PyObject* args, PyObject* keywords) const
{
// no argument preprocessing
}
- else if (n_actual > max_arity)
- {
- // too many arguments
- inner_args = handle<>();
- }
else
{
// build a new arg tuple, will adjust its size later
diff --git a/contrib/restricted/boost/python/src/object/life_support.cpp b/contrib/restricted/boost/python/src/object/life_support.cpp
index b7e9aa861e..281c3bffc5 100644
--- a/contrib/restricted/boost/python/src/object/life_support.cpp
+++ b/contrib/restricted/boost/python/src/object/life_support.cpp
@@ -93,7 +93,7 @@ PyObject* make_nurse_and_patient(PyObject* nurse, PyObject* patient)
if (Py_TYPE(&life_support_type) == 0)
{
- Py_TYPE(&life_support_type) = &PyType_Type;
+ Py_SET_TYPE(&life_support_type, &PyType_Type);
PyType_Ready(&life_support_type);
}
diff --git a/contrib/restricted/boost/python/src/wrapper.cpp b/contrib/restricted/boost/python/src/wrapper.cpp
index f8feaef947..8b1b884769 100644
--- a/contrib/restricted/boost/python/src/wrapper.cpp
+++ b/contrib/restricted/boost/python/src/wrapper.cpp
@@ -25,7 +25,7 @@ namespace detail
if (
PyMethod_Check(m.get())
- && ((PyMethodObject*)m.get())->im_self == this->m_self
+ && PyMethod_GET_SELF(m.get()) == this->m_self
&& class_object->tp_dict != 0
)
{
@@ -34,7 +34,7 @@ namespace detail
}
- if (borrowed_f != ((PyMethodObject*)m.get())->im_func)
+ if (borrowed_f != PyMethod_GET_FUNCTION(m.get()))
return override(m);
}
}