diff options
author | Bruce Merry <1963944+bmerry@users.noreply.github.com> | 2024-04-11 14:41:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-11 14:41:55 (GMT) |
commit | 01a51f949475f1590eb5899f3002304060501ab2 (patch) | |
tree | 88528120d948fd0b392f0628a02ad57230f29f4f /Doc | |
parent | 898f6de63fd5285006ee0f4993aeb8ed3e8f97f9 (diff) | |
download | cpython-01a51f949475f1590eb5899f3002304060501ab2.zip cpython-01a51f949475f1590eb5899f3002304060501ab2.tar.gz cpython-01a51f949475f1590eb5899f3002304060501ab2.tar.bz2 |
gh-117722: Fix Stream.readuntil with non-bytes buffer objects (#117723)
gh-16429 introduced support for an iterable of separators in
Stream.readuntil. Since bytes-like types are themselves iterable, this
can introduce ambiguities in deciding whether the argument is an
iterator of separators or a singleton separator. In gh-16429, only 'bytes'
was considered a singleton, but this will break code that passes other
buffer object types.
Fix it by only supporting tuples rather than arbitrary iterables.
Closes gh-117722.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/asyncio-stream.rst | 4 | ||||
-rw-r--r-- | Doc/whatsnew/3.13.rst | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/Doc/library/asyncio-stream.rst b/Doc/library/asyncio-stream.rst index 6231b49..3fdc79b 100644 --- a/Doc/library/asyncio-stream.rst +++ b/Doc/library/asyncio-stream.rst @@ -260,7 +260,7 @@ StreamReader buffer is reset. The :attr:`IncompleteReadError.partial` attribute may contain a portion of the separator. - The *separator* may also be an :term:`iterable` of separators. In this + The *separator* may also be a tuple of separators. In this case the return value will be the shortest possible that has any separator as the suffix. For the purposes of :exc:`LimitOverrunError`, the shortest possible separator is considered to be the one that @@ -270,7 +270,7 @@ StreamReader .. versionchanged:: 3.13 - The *separator* parameter may now be an :term:`iterable` of + The *separator* parameter may now be a :class:`tuple` of separators. .. method:: at_eof() diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index d394fbe..65985dd 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -324,6 +324,10 @@ asyncio :exc:`asyncio.QueueShutDown`) for queue termination. (Contributed by Laurie Opperman and Yves Duprat in :gh:`104228`.) +* Accept a tuple of separators in :meth:`asyncio.StreamReader.readuntil`, + stopping when one of them is encountered. + (Contributed by Bruce Merry in :gh:`81322`.) + base64 ------ |