Skip to content

Commit f94cb78

Browse files
[3.12] tarfile: Fix positional-only syntax in docs (GH-105770) (#105773)
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 0cb670f commit f94cb78

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
@@ -903,7 +903,7 @@ can be:
903903
path to where the archive is extracted (i.e. the same path is used for all
904904
members)::
905905

906-
filter(/, member: TarInfo, path: str) -> TarInfo | None
906+
filter(member: TarInfo, path: str, /) -> TarInfo | None
907907

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

926-
.. function:: fully_trusted_filter(/, member, path)
926+
.. function:: fully_trusted_filter(member, path)
927927

928928
Return *member* unchanged.
929929

930930
This implements the ``'fully_trusted'`` filter.
931931

932-
.. function:: tar_filter(/, member, path)
932+
.. function:: tar_filter(member, path)
933933

934934
Implements the ``'tar'`` filter.
935935

@@ -946,7 +946,7 @@ reused in custom filters:
946946

947947
Return the modified ``TarInfo`` member.
948948

949-
.. function:: data_filter(/, member, path)
949+
.. function:: data_filter(member, path)
950950

951951
Implements the ``'data'`` filter.
952952
In addition to what ``tar_filter`` does:

0 commit comments

Comments
 (0)