summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2024-05-06 19:48:14 +0200
committerHelmut Grohne <helmut@subdivi.de>2024-05-06 19:48:14 +0200
commitdde202c733fe9a30932f56b2fcfc2dfafa5d7a63 (patch)
tree5611ba0b33494accc618b54cce3c59d8589330b8
parent3298139e65d5132c8895923b251f4fe84b2b2568 (diff)
downloadpython-linuxnamespaces-dde202c733fe9a30932f56b2fcfc2dfafa5d7a63.tar.gz
chroottar.py: don't raise NotImplementedError for misuse
The mode actually can only have these three distinct literals. While more complex modes can get passed to TarFile.open, they're decomposed there and only of these three is passed to the compressor openers.
-rwxr-xr-xexamples/chroottar.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/chroottar.py b/examples/chroottar.py
index 49d9a7d..b210649 100755
--- a/examples/chroottar.py
+++ b/examples/chroottar.py
@@ -34,7 +34,7 @@ class TarFile(tarfile.TarFile):
fileobj: typing.BinaryIO | None = None,
) -> tarfile.TarFile:
if mode not in ("r", "w", "x"):
- raise NotImplementedError(f"mode `{mode}' not implemented for zst")
+ raise ValueError("mode must be 'r', 'w' or 'x'")
openobj: str | typing.BinaryIO = name if fileobj is None else fileobj
try:
import zstandard