Skip to content

Commit

Permalink
Avoid setting __doc__ on instance methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jvansanten authored and stefanseefeld committed Sep 18, 2024
1 parent c76d67e commit 301256c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/object/function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,13 @@ BOOST_PYTHON_DECL void add_to_namespace(

BOOST_PYTHON_DECL object const& add_doc(object const& attribute, char const* doc)
{
#if PY_VERSION_HEX >= 0x03000000
if (PyInstanceMethod_Check(attribute.ptr())) {
#else
if (PyMethod_Check(attribute.ptr())) {
#endif
return attribute;
}
return function::add_doc(attribute, doc);
}

Expand Down

0 comments on commit 301256c

Please sign in to comment.