diff --git a/_drgn.pyi b/_drgn.pyi index 22e96b02b..6b2ae7e64 100644 --- a/_drgn.pyi +++ b/_drgn.pyi @@ -38,6 +38,11 @@ if sys.version_info < (3, 10): else: from typing import TypeAlias +if sys.version_info < (3, 12): + from typing_extensions import Buffer +else: + from collections.abc import Buffer + # This is effectively typing.SupportsIndex without @typing.runtime_checkable # (both of which are only available since Python 3.8), with a more # self-explanatory name. @@ -1534,7 +1539,7 @@ class Object: cls, prog: Program, type: Union[str, Type], - bytes: bytes, + bytes: Buffer, *, bit_offset: IntegerLike = 0, bit_field_size: Optional[IntegerLike] = None, @@ -1542,6 +1547,9 @@ class Object: """ Return a value object from its binary representation. + >>> print(Object.from_bytes_(prog, "int", b"\x10\x00\x00\x00")) + (int)16 + :param prog: Program to create the object in. :param type: Type of the object. :param bytes: Buffer containing value of the object.