Skip to content

Commit 301256c

Browse files
jvansantenstefanseefeld
authored andcommitted
Avoid setting __doc__ on instance methods
1 parent c76d67e commit 301256c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/object/function.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,13 @@ BOOST_PYTHON_DECL void add_to_namespace(
586586

587587
BOOST_PYTHON_DECL object const& add_doc(object const& attribute, char const* doc)
588588
{
589+
#if PY_VERSION_HEX >= 0x03000000
590+
if (PyInstanceMethod_Check(attribute.ptr())) {
591+
#else
592+
if (PyMethod_Check(attribute.ptr())) {
593+
#endif
594+
return attribute;
595+
}
589596
return function::add_doc(attribute, doc);
590597
}
591598

0 commit comments

Comments
 (0)