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

bug fixes

[SVN r14623]
This commit is contained in:
Dave Abrahams
2002-07-27 05:50:10 +00:00
parent 19036c14f5
commit 6907df1457
3 changed files with 13 additions and 21 deletions

View File

@@ -195,12 +195,11 @@ class class_ : public objects::class_base
self& add_property(char const* name, object const& fget);
self& add_property(char const* name, object const& fget, object const& fset);
self& setattr(char const* name, object const&);
template <class T>
self& bind(char const* name, T const& x)
template <class U>
self& setattr(char const* name, U const& x)
{
return this->setattr(name, object(x));
this->base::setattr(name, object(x));
return *this;
}
// Pickle support
@@ -293,13 +292,6 @@ inline class_<T,X1,X2,X3>& class_<T,X1,X2,X3>::add_property(char const* name, ob
return *this;
}
template <class T, class X1, class X2, class X3>
inline class_<T,X1,X2,X3>& class_<T,X1,X2,X3>::setattr(char const* name, object const& x)
{
base::setattr(name, x);
return *this;
}
namespace detail
{
// This is an mpl BinaryMetaFunction object with a runtime behavior,

View File

@@ -43,9 +43,9 @@ struct default_iterator_call_policies
template <class NextPolicies, class Iterator>
struct iterator_range
{
iterator_range(handle<> sequence, Iterator start, Iterator finish);
iterator_range(object sequence, Iterator start, Iterator finish);
handle<> m_sequence; // Keeps the sequence alive while iterating.
object m_sequence; // Keeps the sequence alive while iterating.
Iterator m_start;
Iterator m_finish;
};
@@ -134,7 +134,7 @@ namespace detail
return class_<range_>(name)
.def("__iter__", identity_function())
.bind("next", next_function)
.setattr("next", next_function)
;
}
@@ -173,7 +173,7 @@ namespace detail
// Build and convert the iterator_range<>.
return cr(
iterator_range<NextPolicies,Iterator>(
handle<>(python::borrowed(arg0))
object((python::detail::borrowed_reference)arg0)
, get_start(x), get_finish(x)));
}
};
@@ -210,7 +210,7 @@ inline object make_iterator_function(
//
template <class NextPolicies, class Iterator>
inline iterator_range<NextPolicies,Iterator>::iterator_range(
handle<> sequence, Iterator start, Iterator finish)
object sequence, Iterator start, Iterator finish)
: m_sequence(sequence), m_start(start), m_finish(finish)
{
}

View File

@@ -299,8 +299,8 @@ namespace objects
void class_base::add_property(char const* name, object const& fget)
{
object property(
python::detail::new_reference(
PyObject_CallFunction((PyObject*)&PyProperty_Type, "O", fget.ptr())));
(python::detail::new_reference)
PyObject_CallFunction((PyObject*)&PyProperty_Type, "O", fget.ptr()));
this->setattr(name, property);
}
@@ -308,8 +308,8 @@ namespace objects
void class_base::add_property(char const* name, object const& fget, object const& fset)
{
object property(
python::detail::new_reference(
PyObject_CallFunction((PyObject*)&PyProperty_Type, "OO", fget.ptr(), fset.ptr())));
(python::detail::new_reference)
PyObject_CallFunction((PyObject*)&PyProperty_Type, "OO", fget.ptr(), fset.ptr()));
this->setattr(name, property);
}