MCPcopy Create free account
hub / github.com/pybind/pybind11 / annotations

Method annotations

include/pybind11/pytypes.h:2643–2654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2641
2642template <typename D>
2643object object_api<D>::annotations() const {
2644// This is needed again because of the lazy annotations added in 3.14+
2645#if PY_VERSION_HEX < 0x030A0000 || PY_VERSION_HEX >= 0x030E0000
2646 // https://docs.python.org/3/howto/annotations.html#accessing-the-annotations-dict-of-an-object-in-python-3-9-and-older
2647 if (!hasattr(derived(), "__annotations__")) {
2648 setattr(derived(), "__annotations__", dict());
2649 }
2650 return attr("__annotations__");
2651#else
2652 return getattr(derived(), "__annotations__", dict());
2653#endif
2654}
2655
2656template <typename D>
2657handle object_api<D>::get_type() const {

Callers

nothing calls this directly

Calls 5

hasattrFunction · 0.85
derivedClass · 0.85
setattrFunction · 0.85
dictClass · 0.85
getattrFunction · 0.85

Tested by

no test coverage detected