mirror of
https://github.com/boostorg/python.git
synced 2026-01-28 07:22:31 +00:00
* object(f), where f is a function pointer now works. Returning a
* function pointer from a function should work also. * make_function/make_constructor now return object instead of a raw pointer. * module::setattr() now accepts anything which can be passed to object's constructor. * Rework upcast<> to catch more errors at compile-time instead of infinite-looping. * Rationalize class<>::def() in preparation for docstring support * Partial docstring support in module::def (untested) * dependent<> trick moved to detail namespace and separate header * Added __doc__ attribute to C++ function wrapper objects * Sunk implementation of function_object into a library source file. [SVN r14724]
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <boost/python/object/iterator_core.hpp>
|
||||
#include <boost/python/object/function.hpp>
|
||||
#include <boost/python/handle.hpp>
|
||||
#include <boost/python/object/function_object.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
@@ -18,9 +18,9 @@ static PyObject* identity(PyObject* args_, PyObject*)
|
||||
return x;
|
||||
}
|
||||
|
||||
BOOST_PYTHON_DECL handle<> identity_function()
|
||||
BOOST_PYTHON_DECL object const& identity_function()
|
||||
{
|
||||
static handle<> result(new objects::function(py_function(&identity), 1));
|
||||
static object result(function_object(&identity, 1));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user