
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2014-06-11 15:59 byvajrasky, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| asyncio_queue_accept_handles_maxsize.patch | vajrasky,2014-06-11 15:59 | review | ||
| Messages (8) | |||
|---|---|---|---|
| msg220280 -(view) | Author: Vajrasky Kok (vajrasky)* | Date: 2014-06-11 15:59 | |
import asyncioloop = asyncio.get_event_loop()q = asyncio.Queue(maxsize=1.2, loop=loop)q.put_nowait(1)q.put_nowait(1)q.put_nowait(1)q.put_nowait(1)q.put_nowait(1).... and so onIt seems counter intuitive for my innocent eyes. As comparison with the traditional queue:import queueq = queue.Queue(maxsize=1.2)q.put(1)q.put(1)q.put(1) -> blockingHere is the patch to make the behaviour consistent with its sibling. | |||
| msg220283 -(view) | Author: STINNER Victor (vstinner)*![]() | Date: 2014-06-11 16:12 | |
It looks strange to use a float as maxsize. I suggest to raise a TypeError in the constructor if the type is not int, or maybe to cast maxsize parameter to an int. | |||
| msg220289 -(view) | Author: Yury Selivanov (yselivanov)*![]() | Date: 2014-06-11 17:22 | |
FWIW, this can also be resolved by fixing Queue.full to do "self.qsize() >= self._maxsize" instead of "self.qsize() == self._maxsize".I generally don't like implicit casts as they break duck typing. | |||
| msg220360 -(view) | Author: Vajrasky Kok (vajrasky)* | Date: 2014-06-12 16:08 | |
"It looks strange to use a float as maxsize." => It is. But the float could be coming programmatically. Float value interpreted as infinity could give a shock for some people."maybe to cast maxsize parameter to an int." => ceiling or flooring? | |||
| msg220840 -(view) | Author: Guido van Rossum (gvanrossum)*![]() | Date: 2014-06-17 15:51 | |
The patch looks fine to me. | |||
| msg220899 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2014-06-17 21:40 | |
New changesetccfc13183fea by Victor Stinner in branch '3.4':Issue#21723: asyncio.Queue: support any type of number (ex: float) for thehttp://hg.python.org/cpython/rev/ccfc13183feaNew changeseta2f115bfa513 by Victor Stinner in branch 'default':(Merge 3.4) Issue#21723: asyncio.Queue: support any type of number (ex: float)http://hg.python.org/cpython/rev/a2f115bfa513 | |||
| msg220906 -(view) | Author: STINNER Victor (vstinner)*![]() | Date: 2014-06-17 22:07 | |
Thanks Vajrasky, I aplied your patch. | |||
| msg220907 -(view) | Author: STINNER Victor (vstinner)*![]() | Date: 2014-06-17 22:07 | |
Change also pushed to Tulip (changeset3a392e5328c0). | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:04 | admin | set | github: 65922 |
| 2014-06-17 22:44:52 | emptysquare | set | nosy: +emptysquare |
| 2014-06-17 22:07:47 | vstinner | set | messages: +msg220907 |
| 2014-06-17 22:07:42 | vstinner | set | status: open -> closed resolution: fixed messages: +msg220906 |
| 2014-06-17 21:40:59 | python-dev | set | nosy: +python-dev messages: +msg220899 |
| 2014-06-17 15:51:29 | gvanrossum | set | messages: +msg220840 |
| 2014-06-12 16:08:07 | vajrasky | set | messages: +msg220360 |
| 2014-06-11 17:22:16 | yselivanov | set | messages: +msg220289 |
| 2014-06-11 16:12:32 | vstinner | set | messages: +msg220283 |
| 2014-06-11 15:59:54 | vajrasky | create | |