mirror of
https://github.com/boostorg/python.git
synced 2026-01-26 18:52:26 +00:00
const-ify ClassBase::getattr()
Add repr() function to Class<T> Add to_python/from_python conversions for PyPtr<T> Standardize set_item/get_item interfaces (instead of proxies) for Dict and List Add Reprable<> template to newtypes.h Fix a bug wherein the __module__ attribute would be lost for classes that have a default virtual function implementation. [SVN r8091]
This commit is contained in:
@@ -379,6 +379,14 @@ void ExtensionClassBase::add_default_method(PyPtr<Function> method, const char*
|
||||
// clear our dict now. It will henceforth contain only default method
|
||||
// implementations.
|
||||
dict() = Dict();
|
||||
|
||||
// Copy the "__module__" attribute from the fake base class, if any
|
||||
PyObject *module_name = PyDict_GetItemString(new_base->dict().get(), "__module__");
|
||||
if (module_name != 0 && PyString_Check(module_name))
|
||||
{
|
||||
static String module_key("__module__", String::interned);
|
||||
PyDict_SetItem(dict().get(), module_key.get(), module_name);
|
||||
}
|
||||
}
|
||||
Function::add_to_namespace(method, name, dict().get());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user