2
0
mirror of https://github.com/boostorg/python.git synced 2026-02-02 09:02:15 +00:00

Add docstring support for non-static properties.

[SVN r26814]
This commit is contained in:
Jonathan Brandmeyer
2005-01-22 21:41:37 +00:00
parent 4c21a29a9f
commit 5933fdbf39
6 changed files with 50 additions and 35 deletions

View File

@@ -535,20 +535,22 @@ namespace objects
this->attr("__instance_size__") = instance_size;
}
void class_base::add_property(char const* name, object const& fget)
void class_base::add_property(
char const* name, object const& fget, char const* docstr)
{
object property(
(python::detail::new_reference)
PyObject_CallFunction((PyObject*)&PyProperty_Type, "O", fget.ptr()));
PyObject_CallFunction((PyObject*)&PyProperty_Type, "Osss", fget.ptr(), 0, 0, docstr));
this->setattr(name, property);
}
void class_base::add_property(char const* name, object const& fget, object const& fset)
void class_base::add_property(
char const* name, object const& fget, object const& fset, char const* docstr)
{
object property(
(python::detail::new_reference)
PyObject_CallFunction((PyObject*)&PyProperty_Type, "OO", fget.ptr(), fset.ptr()));
PyObject_CallFunction((PyObject*)&PyProperty_Type, "OOss", fget.ptr(), fset.ptr(), 0, docstr));
this->setattr(name, property);
}