Set module name for defined functions

This commit is contained in:
Sylvain Corlay 2016-02-04 15:21:09 -05:00
parent de3ad07899
commit 2a1ce23a3f

View File

@ -470,6 +470,7 @@ public:
sibling((handle) attr(name_)), extra...);
/* PyModule_AddObject steals a reference to 'func' */
PyModule_AddObject(ptr(), name_, func.inc_ref().ptr());
func.attr("__module__") = attr("__name__");
return *this;
}