This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Allow multiple separators in Stream.readuntil
Type: enhancement Stage: patch review
Components: asyncio Versions: Python 3.9
process
Status: open Resolution: later
Dependencies: Superseder:
Assigned To: Nosy List: Jeffrey.Kintscher, asvetlov, bmerry, yselivanov
Priority: normal Keywords: patch

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:16adminsetstatus: pending -> open
github: 81322
2019-09-26 19:48:53yselivanovsetstatus: open -> pending
resolution: later
2019-09-26 19:48:41yselivanovsetmessages: + msg353335
2019-09-26 16:09:32bmerrysetmessages: + msg353323
2019-09-26 16:02:53bmerrysetkeywords: + patch
stage: test needed -> patch review
pull_requests: + pull_request16008
2019-09-12 14:34:45asvetlovsetmessages: + msg352179
2019-09-12 10:20:43bmerrysetmessages: + msg352089
2019-09-12 09:39:28asvetlovlinkissue32395 superseder
2019-06-07 19:57:03terry.reedysetstage: test needed
versions: + Python 3.9, - Python 3.8
2019-06-04 05:40:51Jeffrey.Kintschersetnosy: + Jeffrey.Kintscher
2019-06-03 10:38:04bmerrysetmessages: + msg344409
title: Allow multiple separators in StreamReader.readuntil -> Allow multiple separators in Stream.readuntil
2019-06-03 10:33:13asvetlovsetmessages: + msg344405
2019-06-03 10:28:35bmerrysetmessages: + msg344404
2019-06-03 10:26:01asvetlovsetmessages: + msg344403
2019-06-03 10:06:38bmerrysetmessages: + msg344399
2019-06-03 10:00:56asvetlovsetmessages: + msg344398
2019-06-03 09:32:30bmerrycreate