Skip to content

Commit

Permalink
use getattr
Browse files Browse the repository at this point in the history
  • Loading branch information
InvincibleRMC committed Dec 6, 2024
1 parent 31cc64f commit 4d0968d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/pybind11/pytypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit 4d0968d

Please sign in to comment.