diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-01-20 08:31:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-20 08:31:15 (GMT) |
commit | b2a662fc6b391f176bbf9da45657d21ef5b363ac (patch) | |
tree | bceca26823f948445aa0e900b1971a371d3cea0a /Doc | |
parent | 10c61301240374701279aa8f87bf9f1caf1e9c9a (diff) | |
download | cpython-b2a662fc6b391f176bbf9da45657d21ef5b363ac.zip cpython-b2a662fc6b391f176bbf9da45657d21ef5b363ac.tar.gz cpython-b2a662fc6b391f176bbf9da45657d21ef5b363ac.tar.bz2 |
[3.10] gh-101144: Allow zipfile.Path .open & .read_text encoding to be positional (GH-101179) (GH-101182)
The zipfile.Path open() and read_text() encoding parameter can be supplied as a positional argument without causing a TypeError again. 3.10.0b1 included a regression that made it keyword only.
Documentation update included as users writing code to be compatible with a wide range of versions will need to consider this for some time..
(cherry picked from commit 5927013e47a8c63b70e104152351f3447baa819c)
(cherry picked from commit efe3a389cabd7295e6e0938767cdc4055c871e3c)
Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
Automerge-Triggered-By: GH:gpshead
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/zipfile.rst | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index 10fffb7..eab1eaf 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -509,6 +509,12 @@ Path objects are traversable using the ``/`` operator or ``joinpath``. Added support for text and binary modes for open. Default mode is now text. + .. versionchanged:: 3.10.10 + The ``encoding`` parameter can be supplied as a positional argument + without causing a :exc:`TypeError`. As it could in 3.9. Code needing to + be compatible with unpatched 3.10 and 3.11 versions must pass all + :class:`io.TextIOWrapper` arguments, ``encoding`` included, as keywords. + .. method:: Path.iterdir() Enumerate the children of the current directory. @@ -533,6 +539,12 @@ Path objects are traversable using the ``/`` operator or ``joinpath``. :class:`io.TextIOWrapper` (except ``buffer``, which is implied by the context). + .. versionchanged:: 3.10.10 + The ``encoding`` parameter can be supplied as a positional argument + without causing a :exc:`TypeError`. As it could in 3.9. Code needing to + be compatible with unpatched 3.10 and 3.11 versions must pass all + :class:`io.TextIOWrapper` arguments, ``encoding`` included, as keywords. + .. method:: Path.read_bytes() Read the current file as bytes. |