mirror of
https://github.com/boostorg/python.git
synced 2026-01-19 16:32:16 +00:00
Compare commits
8 Commits
boost-1.69
...
boost-1.70
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9c0e58d57 | ||
|
|
4b01139720 | ||
|
|
65bfec2d97 | ||
|
|
4f6d547c0a | ||
|
|
90813b1ad7 | ||
|
|
b644946368 | ||
|
|
c7799aa44f | ||
|
|
02095af952 |
@@ -132,4 +132,30 @@ lib boost_numpy
|
||||
<link>static:<define>BOOST_NUMPY_STATIC_LIB
|
||||
<python-debugging>on:<define>BOOST_DEBUG_PYTHON
|
||||
;
|
||||
}
|
||||
|
||||
# boost-install creates `stage` and `install` targets
|
||||
#
|
||||
# `stage` stages (builds and copies into `stage/lib`) the given libraries
|
||||
# `boost_python` and `boost_numpy` and their dependencies and is similar
|
||||
# to issuing `b2 --with-python stage` from top level
|
||||
#
|
||||
# `install` installs the two libraries and their dependencies and is similar
|
||||
# to issuing `b2 --with-python install` from top level
|
||||
|
||||
boost-install boost_python boost_numpy ;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
# When Python isn't configured, the above `boost-install` is not executed,
|
||||
# so we create empty `stage` and `install` targets that do nothing but issue
|
||||
# a warning message unless `--without-python` is given
|
||||
|
||||
alias stage : config-warning ;
|
||||
explicit stage ;
|
||||
|
||||
alias install : config-warning ;
|
||||
explicit install ;
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -444,7 +444,9 @@ void function::add_to_namespace(
|
||||
if (dict == 0)
|
||||
throw_error_already_set();
|
||||
|
||||
assert(!PyErr_Occurred());
|
||||
handle<> existing(allow_null(::PyObject_GetItem(dict.get(), name.ptr())));
|
||||
PyErr_Clear();
|
||||
|
||||
if (existing)
|
||||
{
|
||||
@@ -485,16 +487,15 @@ void function::add_to_namespace(
|
||||
if (new_func->name().is_none())
|
||||
new_func->m_name = name;
|
||||
|
||||
assert(!PyErr_Occurred());
|
||||
handle<> name_space_name(
|
||||
allow_null(::PyObject_GetAttrString(name_space.ptr(), const_cast<char*>("__name__"))));
|
||||
PyErr_Clear();
|
||||
|
||||
if (name_space_name)
|
||||
new_func->m_namespace = object(name_space_name);
|
||||
}
|
||||
|
||||
// The PyObject_GetAttrString() or PyObject_GetItem calls above may
|
||||
// have left an active error
|
||||
PyErr_Clear();
|
||||
if (PyObject_SetAttr(ns, name.ptr(), attribute.ptr()) < 0)
|
||||
throw_error_already_set();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user