Skip to content

Commit b1626a9

Browse files
committed
chore: suppress py3.14 warning for tarfile.extractall
Signed-off-by: Brian Harring <[email protected]>
1 parent 9bc744c commit b1626a9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/pkgdev/scripts/pkgdev_commit.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
import re
66
import shlex
77
import subprocess
8+
import sys
89
import tarfile
910
import tempfile
1011
import textwrap
11-
from collections import defaultdict, deque, UserDict
12+
from collections import UserDict, defaultdict, deque
1213
from dataclasses import dataclass
1314
from enum import Enum
1415
from functools import partial
@@ -17,8 +18,8 @@
1718
from pkgcheck import reporters, scan
1819
from pkgcore.ebuild.atom import MalformedAtom
1920
from pkgcore.ebuild.atom import atom as atom_cls
20-
from pkgcore.ebuild.repository import UnconfiguredTree, tree
2121
from pkgcore.ebuild.repo_objs import RepoConfig
22+
from pkgcore.ebuild.repository import UnconfiguredTree, tree
2223
from pkgcore.operations import observer as observer_mod
2324
from pkgcore.restrictions import packages
2425
from snakeoil.cli import arghparse
@@ -317,7 +318,12 @@ def _populate(self, pkgs):
317318
error = old_files.stderr.read().decode().strip()
318319
raise Exception(f"failed populating archive repo: {error}")
319320
with tarfile.open(mode="r|", fileobj=old_files.stdout) as tar:
320-
tar.extractall(path=self.location)
321+
extra_kwargs = {}
322+
# see filter in https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.extractall
323+
# Whilst we trust git archive, we still leave the basic protections on.
324+
if sys.version_info >= (3, 12, 0):
325+
extra_kwargs["filter"] = "data"
326+
tar.extractall(path=self.location, **extra_kwargs)
321327

322328

323329
def change(*statuses):

0 commit comments

Comments
 (0)