Skip to content

Commit aa927f9

Browse files
[3.11] tarfile: Fix positional-only syntax in docs (GH-105770) (#105772)
The syntax used in the current docs (a / before any args) is invalid. I think the right approach is for the arguments to arbitrary filter functions to be treated as positional-only, meaning that users can supply filter functions with any names for the argument. tarfile.py only calls the filter function with positional arguments. (cherry picked from commit 5cdd5ba) Co-authored-by: Jelle Zijlstra <[email protected]>
1 parent c0c4186 commit aa927f9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Doc/library/tarfile.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ can be:
901901
path to where the archive is extracted (i.e. the same path is used for all
902902
members)::
903903

904-
filter(/, member: TarInfo, path: str) -> TarInfo | None
904+
filter(member: TarInfo, path: str, /) -> TarInfo | None
905905

906906
The callable is called just before each member is extracted, so it can
907907
take the current state of the disk into account.
@@ -921,13 +921,13 @@ Default named filters
921921
The pre-defined, named filters are available as functions, so they can be
922922
reused in custom filters:
923923

924-
.. function:: fully_trusted_filter(/, member, path)
924+
.. function:: fully_trusted_filter(member, path)
925925

926926
Return *member* unchanged.
927927

928928
This implements the ``'fully_trusted'`` filter.
929929

930-
.. function:: tar_filter(/, member, path)
930+
.. function:: tar_filter(member, path)
931931

932932
Implements the ``'tar'`` filter.
933933

@@ -944,7 +944,7 @@ reused in custom filters:
944944

945945
Return the modified ``TarInfo`` member.
946946

947-
.. function:: data_filter(/, member, path)
947+
.. function:: data_filter(member, path)
948948

949949
Implements the ``'data'`` filter.
950950
In addition to what ``tar_filter`` does:

0 commit comments

Comments
 (0)