Skip to content

Commit 02a9a0e

Browse files
authored
Deprecate TarInfo.tarfile attribute (#13894)
1 parent 6759cb1 commit 02a9a0e

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

stdlib/tarfile.pyi

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ from collections.abc import Callable, Iterable, Iterator, Mapping
77
from gzip import _ReadableFileobj as _GzipReadableFileobj, _WritableFileobj as _GzipWritableFileobj
88
from types import TracebackType
99
from typing import IO, ClassVar, Literal, Protocol, overload
10-
from typing_extensions import Self, TypeAlias
10+
from typing_extensions import Self, TypeAlias, deprecated
1111

1212
__all__ = [
1313
"TarFile",
@@ -622,7 +622,6 @@ class TarInfo:
622622
offset: int
623623
offset_data: int
624624
sparse: bytes | None
625-
tarfile: TarFile | None
626625
mode: int
627626
type: bytes
628627
linkname: str
@@ -632,6 +631,16 @@ class TarInfo:
632631
gname: str
633632
pax_headers: Mapping[str, str]
634633
def __init__(self, name: str = "") -> None: ...
634+
if sys.version_info >= (3, 13):
635+
@property
636+
@deprecated("Deprecated in Python 3.13; removal scheduled for Python 3.16")
637+
def tarfile(self) -> TarFile | None: ...
638+
@tarfile.setter
639+
@deprecated("Deprecated in Python 3.13; removal scheduled for Python 3.16")
640+
def tarfile(self) -> None: ...
641+
else:
642+
tarfile: TarFile | None
643+
635644
@classmethod
636645
def frombuf(cls, buf: bytes | bytearray, encoding: str, errors: str) -> Self: ...
637646
@classmethod

0 commit comments

Comments
 (0)