[issue42140] asyncio.wait function creates futures set two times
Diogo Dutra added the comment: > I wouldn't be surprised if there are other libraries or apps out there for which removing iterator support was an accidentally-breaking change and it may be strange if this is only is broken in 3.9.x, but working both before and after. Justin, when the deprecation message has been removed, the iterator will works again, because the code will iterate just one time. So the behaviour you describe will happen anyway. My changes proposal is a “improvement”, because the second iteration can be made on the already created set. I think that change make senses because it removes unnecessary data creation. Em ter, 27 de out de 2020 às 00:24, Justin Arthur escreveu: > > Justin Arthur added the comment: > > I believe the documentation may be referring to the English set and not a > Python set, but I could be wrong. > > Yury changed the wording from sequence to set in 3.7, but we didn't > document a breaking change as far as I know. The purpose of those set > constructions was to handle the many things other than a set that can be > passed in that may have non-unique values. Early asyncio documentation > included examples of passing wait() a list. > > I wouldn't be surprised if there are other libraries or apps out there for > which removing iterator support was an accidentally-breaking change and it > may be strange if this is only is broken in 3.9.x, but working both before > and after. > > -- > > ___ > Python tracker > <https://bugs.python.org/issue42140> > ___ > -- ___ Python tracker <https://bugs.python.org/issue42140> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42140] asyncio.wait function creates futures set two times
Diogo Dutra added the comment: > Are you suggesting this is a bug, or is it just a suggested code cleanup? It is a suggested code cleanup. My point is that the code creates two sets based on the Sequence `fs`. I think it is better if the code creates the set just one time, instead of two times. Em dom., 25 de out. de 2020 às 18:57, Chris Jerdonek escreveu: > > Chris Jerdonek added the comment: > > Are you suggesting this is a bug, or is it just a suggested code cleanup? > I ask because the docs suggest that a set should be passed: > https://docs.python.org/3/library/asyncio-task.html#asyncio.wait > > And the docstring says it should be a sequence: > > https://github.com/python/cpython/blob/d1a0a960ee493262fb95a0f5b795b5b6d75cecb8/Lib/asyncio/tasks.py#L373-L376 > > So while code cleanup is okay, I'm not sure support for general iterator > arguments can / should be guaranteed. > > -- > nosy: +chris.jerdonek > > ___ > Python tracker > <https://bugs.python.org/issue42140> > ___ > -- ___ Python tracker <https://bugs.python.org/issue42140> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42140] asyncio.wait function creates futures set two times
New submission from Diogo Dutra : The python3.9 code creates the futures set two times. We can create this set before, avoiding the second creation. This python3.9 behaviour breaks the aiokafka library, because it gives an iterator to that function, so the second iteration become empty. -- components: asyncio messages: 379522 nosy: asvetlov, dutradda, yselivanov priority: normal pull_requests: 21858 severity: normal status: open title: asyncio.wait function creates futures set two times type: enhancement versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue42140> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com