1 // Copyright David Abrahams 2004. 2 // Distributed under the Boost Software License, Version 1.0. (See 3 // accompanying file LICENSE_1_0.txt or copy at 4 // http://www.boost.org/LICENSE_1_0.txt) 5 #include <boost/python/tuple.hpp> 6 7 namespace boost { namespace python { namespace detail { 8 call(object const & arg_)9detail::new_reference tuple_base::call(object const& arg_) 10 { 11 return (detail::new_reference)PyObject_CallFunction( 12 (PyObject*)&PyTuple_Type, const_cast<char*>("(O)"), 13 arg_.ptr()); 14 } 15 tuple_base()16tuple_base::tuple_base() 17 : object(detail::new_reference(PyTuple_New(0))) 18 {} 19 tuple_base(object_cref sequence)20tuple_base::tuple_base(object_cref sequence) 21 : object(call(sequence)) 22 {} 23 24 static struct register_tuple_pytype_ptr 25 { register_tuple_pytype_ptrboost::python::detail::register_tuple_pytype_ptr26 register_tuple_pytype_ptr() 27 { 28 const_cast<converter::registration &>( 29 converter::registry::lookup(boost::python::type_id<boost::python::tuple>()) 30 ).m_class_object = &PyTuple_Type; 31 } 32 }register_tuple_pytype_ptr_; 33 34 35 }}} // namespace boost::python 36