Issue 37141: Allow multiple separators in Stream.readuntil (original) (raw)

Created on 2019-06-03 09:32 by bmerry, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 16429 open bmerry,2019-09-26 16:02
Messages (11)
msg344397 - (view) Author: Bruce Merry (bmerry) * Date: 2019-06-03 09:32
Text-based protocols sometimes allow a choice of newline separator - I work with one that allows either \r or \n. Unfortunately that doesn't work with StreamReader.readuntil, which only accepts a single separator, so I've had to do some hacky things to obtain lines without having to From discussion in issue 32052, it sounded like extending StreamReader.readuntil to support a tuple of separators would be feasible.
msg344398 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2019-06-03 10:00
Would you make a PR? I guess to modify Stream.readuntil() StreamReader is deprecated, I'm not sure if we should add new functionality to this class.
msg344399 - (view) Author: Bruce Merry (bmerry) * Date: 2019-06-03 10:06
I wasn't aware of that deprecation - it doesn't seem to be mentioned at https://docs.python.org/3.8/library/asyncio-stream.html. What is the replacement?
msg344403 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2019-06-03 10:26
Docs will be updated soon. The change has landed a week ago, I had no time for docs update before 3.8 beta. Sorry for that. The idea is: StreamReader and StreamWriter are merged into just Stream, open_connection() is replaced with connect() etc.
msg344404 - (view) Author: Bruce Merry (bmerry) * Date: 2019-06-03 10:28
Ok. Does the new Stream still have a similar interface for readuntil i.e. is this still a relevant request against the new API? I'm happy to let deprecated APIs stay as-is.
msg344405 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2019-06-03 10:33
Yes, Stream supports all StreamReader and StreamWriter methods
msg344409 - (view) Author: Bruce Merry (bmerry) * Date: 2019-06-03 10:38
Ok, I've changed the issue title to refer to Stream. Since this would be a new feature, I assume it's off the table for 3.8, but I'll see if I get time to implement a PR in time for 3.9 (and get someone at work to sign off on the contributor agreement, which might be the harder part). Thanks for the quick and helpful responses.
msg352089 - (view) Author: Bruce Merry (bmerry) * Date: 2019-09-12 10:20
I finally have permission from my employer to sign the contributors agreement, so I'll take a stab at this when I have some free time (unless nobody else gets to it first).
msg352179 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2019-09-12 14:34
please do
msg353323 - (view) Author: Bruce Merry (bmerry) * Date: 2019-09-26 16:09
I've submitted a PR: https://github.com/python/cpython/pull/16429
msg353335 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2019-09-26 19:48
I already mentioned that in the PR, but we'll have to hit a pause on this. We decided to revert the latest streams implementation from 3.8, see https://bugs.python.org/issue38242. The upshot is that what we have in 3.9 should be more amenable for things like this one.
History
Date User Action Args
2022-04-11 14:59:16 admin set status: pending -> opengithub: 81322
2019-09-26 19:48:53 yselivanov set status: open -> pendingresolution: later
2019-09-26 19:48:41 yselivanov set messages: +
2019-09-26 16:09:32 bmerry set messages: +
2019-09-26 16:02:53 bmerry set keywords: + patchstage: test needed -> patch reviewpull_requests: + <pull%5Frequest16008>
2019-09-12 14:34:45 asvetlov set messages: +
2019-09-12 10:20:43 bmerry set messages: +
2019-09-12 09:39:28 asvetlov link issue32395 superseder
2019-06-07 19:57:03 terry.reedy set stage: test neededversions: + Python 3.9, - Python 3.8
2019-06-04 05:40:51 Jeffrey.Kintscher set nosy: + Jeffrey.Kintscher
2019-06-03 10:38:04 bmerry set messages: + title: Allow multiple separators in StreamReader.readuntil -> Allow multiple separators in Stream.readuntil
2019-06-03 10:33:13 asvetlov set messages: +
2019-06-03 10:28:35 bmerry set messages: +
2019-06-03 10:26:01 asvetlov set messages: +
2019-06-03 10:06:38 bmerry set messages: +
2019-06-03 10:00:56 asvetlov set messages: +
2019-06-03 09:32:30 bmerry create