Skip to content

Commit 7cc2282

Browse files
authored
[ctypes] Add note about atypical classmethod behavior (#10795)
1 parent b76b2af commit 7cc2282

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

stdlib/_ctypes.pyi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ class _CData(metaclass=_CDataMeta):
5656
_b_base_: int
5757
_b_needsfree_: bool
5858
_objects: Mapping[Any, int] | None
59+
# At runtime the following classmethods are available only on classes, not
60+
# on instances. This can't be reflected properly in the type system:
61+
#
62+
# Structure.from_buffer(...) # valid at runtime
63+
# Structure(...).from_buffer(...) # invalid at runtime
64+
#
5965
@classmethod
6066
def from_buffer(cls, source: WriteableBuffer, offset: int = ...) -> Self: ...
6167
@classmethod

0 commit comments

Comments
 (0)