Skip to content

Commit 0f43a2f

Browse files
committed
changed name of extension_class_coerce to standard_coerce.
[SVN r8357]
1 parent ecdf8e1 commit 0f43a2f

3 files changed

Lines changed: 25 additions & 27 deletions

File tree

include/boost/python/detail/extension_class.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -721,8 +721,6 @@ class extension_instance : public instance
721721
// Template function implementations
722722
//
723723

724-
tuple extension_class_coerce(ref l, ref r);
725-
726724
template <class T, class U>
727725
extension_class<T, U>::extension_class()
728726
: extension_class_base(typeid(T).name())
@@ -743,7 +741,7 @@ void extension_class<T, U>::def_standard_coerce()
743741
ref coerce_fct = dict().get_item(string("__coerce__"));
744742

745743
if(coerce_fct.get() == 0) // not yet defined
746-
this->def(&extension_class_coerce, "__coerce__");
744+
this->def(&standard_coerce, "__coerce__");
747745
}
748746

749747
template <class T, class U>

include/boost/python/operators.hpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
#ifndef OPERATORS_UK112000_H_
22
#define OPERATORS_UK112000_H_
33

4-
#include <boost/python/detail/functions.hpp>
4+
# include <boost/python/reference.hpp>
5+
# include <boost/python/detail/functions.hpp>
6+
57
// When STLport is used with native streams, _STL::ostringstream().str() is not
6-
// _STL::string, but std::string.
7-
#if defined(__SGI_STL_PORT) ? __SGI_STL_OWN_IOSTREAMS : !defined(__GNUC__)
8-
# include <sstream>
9-
#else
10-
# include <strstream>
11-
#endif
8+
// _STL::string, but std::string. This confuses to_python(), so we'll use
9+
// strstream instead. Also, GCC 2.95.2 doesn't have sstream.
10+
# if defined(__SGI_STL_PORT) ? __SGI_STL_OWN_IOSTREAMS : !defined(__GNUC__) || __GNUC__ > 2
11+
# include <sstream>
12+
# else
13+
# include <strstream>
14+
# endif
1215

1316
namespace boost { namespace python {
1417

18+
tuple standard_coerce(ref l, ref r);
19+
1520
namespace detail {
1621

1722
// helper class for automatic operand type detection

src/extension_class.cpp

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,19 @@ BOOST_PYTHON_END_CONVERSION_NAMESPACE
4646

4747
namespace boost { namespace python {
4848

49-
namespace detail {
49+
tuple standard_coerce(ref l, ref r)
50+
{
51+
// Introduced sequence points for exception-safety.
52+
ref first(detail::operator_dispatcher::create(l, l));
53+
54+
ref second(r->ob_type == &detail::operator_dispatcher::type_obj
55+
? r
56+
: ref(detail::operator_dispatcher::create(r, ref())));
5057

51-
tuple extension_class_coerce(ref l, ref r)
52-
{
53-
// Introduced sequence points for exception-safety.
54-
ref first(operator_dispatcher::create(l, l));
55-
ref second;
56-
57-
if(r->ob_type == &operator_dispatcher::type_obj)
58-
{
59-
second = r;
60-
}
61-
else
62-
{
63-
second = ref(operator_dispatcher::create(r, ref()));
64-
}
65-
return boost::python::tuple(first, second);
66-
}
58+
return tuple(first, second);
59+
}
60+
61+
namespace detail {
6762

6863
enum { unwrap_exception_code = -1000 };
6964

0 commit comments

Comments
 (0)