mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-28 22:02:43 +00:00
use getattr
This commit is contained in:
parent
31cc64f414
commit
4d0968dea8
@ -2572,7 +2572,7 @@ object object_api<D>::annotations() const {
|
|||||||
// Python 3.8, 3.9
|
// Python 3.8, 3.9
|
||||||
#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION <= 9
|
#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION <= 9
|
||||||
if (isinstance<type>(derived())) {
|
if (isinstance<type>(derived())) {
|
||||||
return getattr(derived(), "__dict__").get("__annotations__", dict());
|
return getattr(getattr(derived(), "__dict__"), "__annotations__", dict());
|
||||||
} else {
|
} else {
|
||||||
return getattr(derived(), "__annotations__", dict());
|
return getattr(derived(), "__annotations__", dict());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user