mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-28 13:52:46 +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
|
||||
#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION <= 9
|
||||
if (isinstance<type>(derived())) {
|
||||
return getattr(derived(), "__dict__").get("__annotations__", dict());
|
||||
return getattr(getattr(derived(), "__dict__"), "__annotations__", dict());
|
||||
} else {
|
||||
return getattr(derived(), "__annotations__", dict());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user