gh-102120: [TarFile] Add an iter function that doesn't cache (GH-102128)

This commit is contained in:
Robert O'Shea 2023-05-23 21:44:40 +01:00 committed by GitHub
parent 097b7830cd
commit 50fce89d12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 7 deletions

View file

@ -318,7 +318,7 @@ be finalized; only the internally used file object will be closed. See the
.. versionadded:: 3.2
Added support for the context management protocol.
.. class:: TarFile(name=None, mode='r', fileobj=None, format=DEFAULT_FORMAT, tarinfo=TarInfo, dereference=False, ignore_zeros=False, encoding=ENCODING, errors='surrogateescape', pax_headers=None, debug=0, errorlevel=1)
.. class:: TarFile(name=None, mode='r', fileobj=None, format=DEFAULT_FORMAT, tarinfo=TarInfo, dereference=False, ignore_zeros=False, encoding=ENCODING, errors='surrogateescape', pax_headers=None, debug=0, errorlevel=1, stream=False)
All following arguments are optional and can be accessed as instance attributes
as well.
@ -369,6 +369,9 @@ be finalized; only the internally used file object will be closed. See the
The *pax_headers* argument is an optional dictionary of strings which
will be added as a pax global header if *format* is :const:`PAX_FORMAT`.
If *stream* is set to :const:`True` then while reading the archive info about files
in the archive are not cached, saving memory.
.. versionchanged:: 3.2
Use ``'surrogateescape'`` as the default for the *errors* argument.
@ -378,6 +381,8 @@ be finalized; only the internally used file object will be closed. See the
.. versionchanged:: 3.6
The *name* parameter accepts a :term:`path-like object`.
.. versionchanged:: 3.13
Add the *stream* parameter.
.. classmethod:: TarFile.open(...)