[issue32395] asyncio.StreamReader.readuntil is not general enough

2019-09-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Agree

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Allow multiple separators in Stream.readuntil

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32395] asyncio.StreamReader.readuntil is not general enough

2019-09-12 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I think this is a duplicate of issue37141 where multiple separators are 
requested for readuntil. I guess we can close one of them as duplicates.

--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32395] asyncio.StreamReader.readuntil is not general enough

2018-07-26 Thread Anton Patrushev


Change by Anton Patrushev :


--
nosy: +socketpair

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32395] asyncio.StreamReader.readuntil is not general enough

2017-12-20 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

Support multiple separators looks easy, I don't expect any performance impact.
Like we already have it for strings: s.startswith(('\n', '\r'))

Regexps are more expensive thing, callbacks are kind of evil.

Let's add a patch for multiple separators first, maybe it covers 99.9% use 
cases.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32395] asyncio.StreamReader.readuntil is not general enough

2017-12-20 Thread Yury Selivanov

Change by Yury Selivanov :


--
nosy: +asvetlov

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32395] asyncio.StreamReader.readuntil is not general enough

2017-12-20 Thread Bruce Merry

New submission from Bruce Merry :

I'd proposed one specific solution in Issue 32052 which asvetlov didn't like, 
so as requested I'm filing a bug about the problem rather than the solution.

The specific case I have is reading a protocol in which either \r or \n can be 
used to terminate lines. With StreamReader.readuntil, it's only possible to 
specify one separator, so it can't easily be used (*).

Some nice-to-have features, from specific to general:
1. Specify multiple alternate separators.
2. Specify a regex for a separator.
3. Specify a regex for the line.
4. Specify a callback that takes a string and returns the position of the end 
of the line, if any.

Of course, some of these risk quadratic-time behaviour if they have to check 
the whole buffer every time the buffer is extended, so that would need to be 
considered in the design. In the last case, the callback could take care of it 
itself by maintaining internal state.


(*) I actually have a solution for this case 
(https://github.com/ska-sa/aiokatcp/blob/bd8263cefe213003a218fac0dd8c5207cc76aeef/aiokatcp/connection.py#L44-L52),
 but it only works because \r and \n are semantically equivalent in the 
particular protocol I'm parsing.

--
components: asyncio
messages: 308852
nosy: Bruce Merry, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.StreamReader.readuntil is not general enough
type: enhancement
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com