2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-23 05:42:30 +00:00

new docstring_options to support customization of __doc__ attributes of Boost.Python functions

[SVN r32297]
This commit is contained in:
Ralf W. Grosse-Kunstleve
2006-01-12 19:15:38 +00:00
parent 19a196493f
commit 2261e7eedc
4 changed files with 172 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/python/object/function.hpp>
#include <boost/python/docstring_options.hpp>
#include <boost/python/object/function_object.hpp>
#include <boost/python/object/function_handle.hpp>
#include <boost/python/errors.hpp>
@@ -28,6 +28,11 @@
# include <cstdio>
#endif
namespace boost { namespace python {
volatile bool docstring_options::show_user_defined_ = true;
volatile bool docstring_options::show_signatures_ = true;
}}
namespace boost { namespace python { namespace objects {
py_function_impl_base::~py_function_impl_base()
@@ -480,7 +485,7 @@ void function::add_to_namespace(
throw_error_already_set();
object mutable_attribute(attribute);
if (doc != 0)
if (doc != 0 && docstring_options::show_user_defined_)
{
// Accumulate documentation
@@ -496,6 +501,7 @@ void function::add_to_namespace(
}
}
if (docstring_options::show_signatures_)
{
if ( PyObject_HasAttrString(mutable_attribute.ptr(), "__doc__")
&& mutable_attribute.attr("__doc__")) {