diff options
| author | robot-contrib <[email protected]> | 2022-09-17 22:03:44 +0300 |
|---|---|---|
| committer | robot-contrib <[email protected]> | 2022-09-17 22:03:44 +0300 |
| commit | 49726f2627f20969d8e6358fc107bdf139c87f99 (patch) | |
| tree | f94d610e293cb577fbf973b1d0ac07c005c948d0 /contrib/restricted/boost/python/include | |
| parent | e4065899cddff8a7bde3bc774f33e9b6bebd961c (diff) | |
Update contrib/restricted/boost/interprocess to 1.80.0
Diffstat (limited to 'contrib/restricted/boost/python/include')
13 files changed, 86 insertions, 34 deletions
diff --git a/contrib/restricted/boost/python/include/boost/python/call.hpp b/contrib/restricted/boost/python/include/boost/python/call.hpp index 5d2d7d23418..c057ee9a12f 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 410f66820e2..424077eab42 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 9c8907cd6fd..18dd9286846 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 1bd30bfb5a0..2834d6da995 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 acf588311fa..8dce9b742ee 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 9fdb222c681..037e4bf2ec5 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 10fd40fda57..0d5e2c8fd94 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 129c61f9e42..c15604c91c4 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 e2f65721fb0..874950365de 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 31ec08f7c35..5eb3aa9d9c4 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 24a24ad8d1e..26ebb426ba9 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 39714257f93..b631226fd6f 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 287daba4580..8e97aa40649 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 ([email protected]) // 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 |
