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 6 #include <boost/python/cast.hpp> 7 #include <boost/detail/lightweight_test.hpp> 8 9 struct X { long x; }; 10 struct Y : X, PyObject {}; 11 main()12int main() 13 { 14 PyTypeObject o; 15 Y y; 16 BOOST_TEST(&Py_REFCNT(boost::python::upcast<PyObject>(&o)) == &Py_REFCNT(&o)); 17 BOOST_TEST(&Py_REFCNT(boost::python::upcast<PyObject>(&y)) == &Py_REFCNT(&y)); 18 return boost::report_errors(); 19 } 20