diff options
-rwxr-xr-x | examples/unschroot.py | 5 | ||||
-rw-r--r-- | linuxnamespaces/__init__.py | 2 | ||||
-rw-r--r-- | linuxnamespaces/atlocation.py | 2 | ||||
-rw-r--r-- | linuxnamespaces/tarutils.py | 6 | ||||
-rw-r--r-- | tests/test_simple.py | 1 |
5 files changed, 12 insertions, 4 deletions
diff --git a/examples/unschroot.py b/examples/unschroot.py index 682b5b0..5f644fc 100755 --- a/examples/unschroot.py +++ b/examples/unschroot.py @@ -207,6 +207,7 @@ def do_run_session(args: argparse.Namespace) -> None: gidmap = linuxnamespaces.IDAllocation.loadsubid("gid").allocatemap(65536) mainsock, childsock = socket.socketpair() pid = os.fork() + pidfd: int if pid == 0: mainsock.close() os.chdir(session.path) @@ -281,7 +282,9 @@ def do_run_session(args: argparse.Namespace) -> None: os.waitpid(pid, 0) linuxnamespaces.prctl_set_child_subreaper(False) mainsock.send(b"\0") - sys.exit(os.waitid(os.P_PIDFD, pidfd, os.WEXITED).si_status) + wres = os.waitid(os.P_PIDFD, pidfd, os.WEXITED) + assert wres is not None + sys.exit(wres.si_status) def do_end_session(args: argparse.Namespace) -> None: diff --git a/linuxnamespaces/__init__.py b/linuxnamespaces/__init__.py index 65dfc8d..5a9ef39 100644 --- a/linuxnamespaces/__init__.py +++ b/linuxnamespaces/__init__.py @@ -16,7 +16,7 @@ import stat import subprocess import typing -from .filedescriptor import FileDescriptor +from .filedescriptor import * from .atlocation import * from .syscalls import * diff --git a/linuxnamespaces/atlocation.py b/linuxnamespaces/atlocation.py index 8a38650..20d402a 100644 --- a/linuxnamespaces/atlocation.py +++ b/linuxnamespaces/atlocation.py @@ -21,7 +21,7 @@ from .filedescriptor import FileDescriptor AT_FDCWD = FileDescriptor(-100) -PathConvertible = typing.Union[str, os.PathLike] +PathConvertible = typing.Union[str, os.PathLike[str]] class AtFlags(enum.IntFlag): diff --git a/linuxnamespaces/tarutils.py b/linuxnamespaces/tarutils.py index facb537..6285d5a 100644 --- a/linuxnamespaces/tarutils.py +++ b/linuxnamespaces/tarutils.py @@ -19,7 +19,11 @@ TarPath = str | bytes | os.PathLike[str] | os.PathLike[bytes] class ZstdTarFile(tarfile.TarFile): """Subclass of tarfile.TarFile that can read zstd compressed archives.""" - OPEN_METH = {"zst": "zstopen"} | tarfile.TarFile.OPEN_METH + # mypy types OPEN_METH as Mapping rather than dict while it really is a + # dict. Hence, it complains that there is no __or__ for dict and Mapping. + OPEN_METH = { + "zst": "zstopen", + } | tarfile.TarFile.OPEN_METH # type: ignore[operator] @classmethod def zstopen( diff --git a/tests/test_simple.py b/tests/test_simple.py index 878e985..e971e22 100644 --- a/tests/test_simple.py +++ b/tests/test_simple.py @@ -161,6 +161,7 @@ class AsnycioTest(unittest.IsolatedAsyncioTestCase): self.assertTrue(fut.done()) exc = fut.exception() self.assertIsInstance(exc, OSError) + assert isinstance(exc, OSError) # also tell mypy self.assertEqual(exc.errno, errno.EPIPE) |