[issue21723] Float maxsize is treated as infinity in asyncio.Queue

2014-06-17 Thread Guido van Rossum

Guido van Rossum added the comment:

The patch looks fine to me.

--

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



[issue21723] Float maxsize is treated as infinity in asyncio.Queue

2014-06-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ccfc13183fea by Victor Stinner in branch '3.4':
Issue #21723: asyncio.Queue: support any type of number (ex: float) for the
http://hg.python.org/cpython/rev/ccfc13183fea

New changeset a2f115bfa513 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

--
nosy: +python-dev

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



[issue21723] Float maxsize is treated as infinity in asyncio.Queue

2014-06-17 Thread STINNER Victor

STINNER Victor added the comment:

Change also pushed to Tulip (changeset 3a392e5328c0).

--

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



[issue21723] Float maxsize is treated as infinity in asyncio.Queue

2014-06-17 Thread STINNER Victor

STINNER Victor added the comment:

Thanks Vajrasky, I aplied your patch.

--
resolution:  - fixed
status: open - closed

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



[issue21723] Float maxsize is treated as infinity in asyncio.Queue

2014-06-17 Thread A. Jesse Jiryu Davis

Changes by A. Jesse Jiryu Davis je...@emptysquare.net:


--
nosy: +emptysquare

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



[issue21723] Float maxsize is treated as infinity in asyncio.Queue

2014-06-12 Thread Vajrasky Kok

Vajrasky Kok added the comment:

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?

--

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



[issue21723] Float maxsize is treated as infinity in asyncio.Queue

2014-06-11 Thread Vajrasky Kok

New submission from Vajrasky Kok:

import asyncio

loop = 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 on

It seems counter intuitive for my innocent eyes. As comparison with the 
traditional queue:

import queue
q = queue.Queue(maxsize=1.2)
q.put(1)
q.put(1)
q.put(1) - blocking

Here is the patch to make the behaviour consistent with its sibling.

--
components: asyncio
files: asyncio_queue_accept_handles_maxsize.patch
keywords: patch
messages: 220280
nosy: gvanrossum, haypo, vajrasky, yselivanov
priority: normal
severity: normal
status: open
title: Float maxsize is treated as infinity in asyncio.Queue
type: behavior
versions: Python 3.5
Added file: 
http://bugs.python.org/file35574/asyncio_queue_accept_handles_maxsize.patch

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



[issue21723] Float maxsize is treated as infinity in asyncio.Queue

2014-06-11 Thread STINNER Victor

STINNER Victor added the comment:

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.

--

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



[issue21723] Float maxsize is treated as infinity in asyncio.Queue

2014-06-11 Thread Yury Selivanov

Yury Selivanov added the comment:

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.

--

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