From ba7f822b1283d50432ec448563212d860c079c45 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Wed, 21 May 2025 22:00:36 +0200 Subject: fix type checking on mypy/1.15 --- linuxnamespaces/syscalls.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/linuxnamespaces/syscalls.py b/linuxnamespaces/syscalls.py index be0a5f7..9528b07 100644 --- a/linuxnamespaces/syscalls.py +++ b/linuxnamespaces/syscalls.py @@ -26,17 +26,17 @@ LIBC_SO = ctypes.CDLL(None, use_errno=True) if typing.TYPE_CHECKING: - CData = ctypes._CData # pylint: disable=protected-access + CDataType = ctypes._CDataType # pylint: disable=protected-access else: - CData = typing.Any + CDataType = typing.Any def _pad_fields( - fields: list[tuple[str, type[CData]]], + fields: list[tuple[str, type[CDataType]]], totalsize: int, name: str, - padtype: type[CData] = ctypes.c_uint8, -) -> list[tuple[str, type[CData]]]: + padtype: type[CDataType] = ctypes.c_uint8, +) -> list[tuple[str, type[CDataType]]]: """Append a padding element to a ctypes.Structure _fields_ sequence such that its total size matches a given value. """ @@ -560,7 +560,7 @@ class EventFD: """Return True unless the eventfd is closed.""" return self.fd >= 0 - def __enter__(self) -> "EventFD": + def __enter__(self) -> typing.Self: """When used as a context manager, the EventFD is closed on scope exit. """ return self @@ -847,7 +847,7 @@ class SignalFD: """Return True unless the signalfd is closed.""" return self.fd >= 0 - def __enter__(self) -> "EventFD": + def __enter__(self) -> typing.Self: """When used as a context manager, the SignalFD is closed on scope exit. """ -- cgit v1.2.3