Skip to content

Commit 1df82ed

Browse files
authored
[ctypes] Add _layout_ attribute for ctypes.Structure (#15091)
1 parent a1d94e7 commit 1df82ed

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stdlib/_ctypes.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from abc import abstractmethod
55
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
66
from ctypes import CDLL, ArgumentError as ArgumentError, c_void_p
77
from types import GenericAlias
8-
from typing import Any, ClassVar, Final, Generic, TypeVar, final, overload, type_check_only
8+
from typing import Any, ClassVar, Final, Generic, Literal, TypeVar, final, overload, type_check_only
99
from typing_extensions import Self, TypeAlias
1010

1111
_T = TypeVar("_T")
@@ -266,6 +266,10 @@ class Structure(_CData, metaclass=_PyCStructType):
266266
if sys.version_info >= (3, 13):
267267
_align_: ClassVar[int]
268268

269+
if sys.version_info >= (3, 14):
270+
# _layout_ can be defined by the user, but is not always present.
271+
_layout_: ClassVar[Literal["ms", "gcc-sysv"]]
272+
269273
def __init__(self, *args: Any, **kw: Any) -> None: ...
270274
def __getattr__(self, name: str) -> Any: ...
271275
def __setattr__(self, name: str, value: Any) -> None: ...

0 commit comments

Comments
 (0)