mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 14:45:12 +00:00
Use get_module_name_if_available()
in detail/class.h
This commit is contained in:
parent
d2a0bf95c7
commit
6430e92ad8
@ -636,15 +636,7 @@ inline PyObject *make_new_python_type(const type_record &rec) {
|
|||||||
PyUnicode_FromFormat("%U.%U", rec.scope.attr("__qualname__").ptr(), name.ptr()));
|
PyUnicode_FromFormat("%U.%U", rec.scope.attr("__qualname__").ptr(), name.ptr()));
|
||||||
}
|
}
|
||||||
|
|
||||||
object module_;
|
object module_ = get_module_name_if_available(rec.scope);
|
||||||
if (rec.scope) {
|
|
||||||
if (hasattr(rec.scope, "__module__")) {
|
|
||||||
module_ = rec.scope.attr("__module__");
|
|
||||||
} else if (hasattr(rec.scope, "__name__")) {
|
|
||||||
module_ = rec.scope.attr("__name__");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto *full_name = c_str(
|
const auto *full_name = c_str(
|
||||||
#if !defined(PYPY_VERSION)
|
#if !defined(PYPY_VERSION)
|
||||||
module_ ? str(module_).cast<std::string>() + "." + rec.name :
|
module_ ? str(module_).cast<std::string>() + "." + rec.name :
|
||||||
|
Loading…
Reference in New Issue
Block a user