1 // Copyright David Abrahams 2002. 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 #ifndef OBJECT_DWA2002612_HPP 6 # define OBJECT_DWA2002612_HPP 7 8 # include <boost/python/ssize_t.hpp> 9 # include <boost/python/object_core.hpp> 10 # include <boost/python/object_attributes.hpp> 11 # include <boost/python/object_items.hpp> 12 # include <boost/python/object_slices.hpp> 13 # include <boost/python/object_operators.hpp> 14 # include <boost/python/converter/arg_to_python.hpp> 15 16 namespace boost { namespace python { 17 len(object const & obj)18 inline ssize_t len(object const& obj) 19 { 20 ssize_t result = PyObject_Length(obj.ptr()); 21 if (PyErr_Occurred()) throw_error_already_set(); 22 return result; 23 } 24 25 }} // namespace boost::python 26 27 #endif // OBJECT_DWA2002612_HPP 28