2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-27 19:12:16 +00:00

changed name of extension_class_coerce to standard_coerce.

[SVN r8357]
This commit is contained in:
Dave Abrahams
2000-11-29 13:42:45 +00:00
parent ecdf8e1591
commit 0f43a2fe9b
3 changed files with 25 additions and 27 deletions

View File

@@ -721,8 +721,6 @@ class extension_instance : public instance
// Template function implementations
//
tuple extension_class_coerce(ref l, ref r);
template <class T, class U>
extension_class<T, U>::extension_class()
: extension_class_base(typeid(T).name())
@@ -743,7 +741,7 @@ void extension_class<T, U>::def_standard_coerce()
ref coerce_fct = dict().get_item(string("__coerce__"));
if(coerce_fct.get() == 0) // not yet defined
this->def(&extension_class_coerce, "__coerce__");
this->def(&standard_coerce, "__coerce__");
}
template <class T, class U>

View File

@@ -1,17 +1,22 @@
#ifndef OPERATORS_UK112000_H_
#define OPERATORS_UK112000_H_
#include <boost/python/detail/functions.hpp>
# include <boost/python/reference.hpp>
# include <boost/python/detail/functions.hpp>
// When STLport is used with native streams, _STL::ostringstream().str() is not
// _STL::string, but std::string.
#if defined(__SGI_STL_PORT) ? __SGI_STL_OWN_IOSTREAMS : !defined(__GNUC__)
# include <sstream>
#else
# include <strstream>
#endif
// _STL::string, but std::string. This confuses to_python(), so we'll use
// strstream instead. Also, GCC 2.95.2 doesn't have sstream.
# if defined(__SGI_STL_PORT) ? __SGI_STL_OWN_IOSTREAMS : !defined(__GNUC__) || __GNUC__ > 2
# include <sstream>
# else
# include <strstream>
# endif
namespace boost { namespace python {
tuple standard_coerce(ref l, ref r);
namespace detail {
// helper class for automatic operand type detection

View File

@@ -46,24 +46,19 @@ BOOST_PYTHON_END_CONVERSION_NAMESPACE
namespace boost { namespace python {
namespace detail {
tuple standard_coerce(ref l, ref r)
{
// Introduced sequence points for exception-safety.
ref first(detail::operator_dispatcher::create(l, l));
ref second(r->ob_type == &detail::operator_dispatcher::type_obj
? r
: ref(detail::operator_dispatcher::create(r, ref())));
tuple extension_class_coerce(ref l, ref r)
{
// Introduced sequence points for exception-safety.
ref first(operator_dispatcher::create(l, l));
ref second;
if(r->ob_type == &operator_dispatcher::type_obj)
{
second = r;
}
else
{
second = ref(operator_dispatcher::create(r, ref()));
}
return boost::python::tuple(first, second);
}
return tuple(first, second);
}
namespace detail {
enum { unwrap_exception_code = -1000 };