From 381f28665ffa49d731fbf96dd9f2ce4b87b73c67 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Thu, 28 Sep 2023 18:54:51 +0200 Subject: [PATCH] [ctypes] Add note about atypical classmethod behavior --- stdlib/_ctypes.pyi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stdlib/_ctypes.pyi b/stdlib/_ctypes.pyi index 1f15ac057988..ce9851bbb802 100644 --- a/stdlib/_ctypes.pyi +++ b/stdlib/_ctypes.pyi @@ -56,6 +56,12 @@ class _CData(metaclass=_CDataMeta): _b_base_: int _b_needsfree_: bool _objects: Mapping[Any, int] | None + # At runtime the following classmethods are available only on classes, not + # on instances. This can't be reflected properly in the type system: + # + # Structure.from_buffer(...) # valid at runtime + # Structure(...).from_buffer(...) # invalid at runtime + # @classmethod def from_buffer(cls, source: WriteableBuffer, offset: int = ...) -> Self: ... @classmethod