Skip to content

Commit 5cdd5ba

Browse files
tarfile: Fix positional-only syntax in docs (GH-105770)
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.
1 parent 6199fe3 commit 5cdd5ba

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
@@ -908,7 +908,7 @@ can be:
908908
path to where the archive is extracted (i.e. the same path is used for all
909909
members)::
910910

911-
filter(/, member: TarInfo, path: str) -> TarInfo | None
911+
filter(member: TarInfo, path: str, /) -> TarInfo | None
912912

913913
The callable is called just before each member is extracted, so it can
914914
take the current state of the disk into account.
@@ -928,13 +928,13 @@ Default named filters
928928
The pre-defined, named filters are available as functions, so they can be
929929
reused in custom filters:
930930

931-
.. function:: fully_trusted_filter(/, member, path)
931+
.. function:: fully_trusted_filter(member, path)
932932

933933
Return *member* unchanged.
934934

935935
This implements the ``'fully_trusted'`` filter.
936936

937-
.. function:: tar_filter(/, member, path)
937+
.. function:: tar_filter(member, path)
938938

939939
Implements the ``'tar'`` filter.
940940

@@ -951,7 +951,7 @@ reused in custom filters:
951951

952952
Return the modified ``TarInfo`` member.
953953

954-
.. function:: data_filter(/, member, path)
954+
.. function:: data_filter(member, path)
955955

956956
Implements the ``'data'`` filter.
957957
In addition to what ``tar_filter`` does:

0 commit comments

Comments
 (0)