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.

Author Alex.Willmer
Recipients Alex.Willmer
Date 2015-09-05.17:12:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1441473173.56.0.310584962633.issue25009@psf.upfronthosting.co.za>
In-reply-to
Content
The maxsize argument when initializing a Queue is expected to be an int (technically anything that can be compared to an int). However the class takes any value. In Python 3 this throws "TypeError: unorderable types" once e.g. .put() is called.

On the basis that errors should not pass silent, should maxsize be checked for compatibility at initialization time? e.g.

Desired:

>>> import queue
>>> q = queue.Queue(range(10))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/queue.py", line nnn, in __init__()
    ...
TypeError: 'range' object cannot be interpreted as an integer


Actual:

Python 3.5.0rc2 (default, Aug 25 2015, 20:29:07) 
[GCC 5.2.1 20150825] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import queue
>>> q = queue.Queue(range(10)) # Silently accepts an invalid maxsize
>>> q.put('foo')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/queue.py", line 127, in put
    if self.maxsize > 0:
TypeError: unorderable types: range() > int()
History
Date User Action Args
2015-09-05 17:12:53Alex.Willmersetrecipients: + Alex.Willmer
2015-09-05 17:12:53Alex.Willmersetmessageid: <1441473173.56.0.310584962633.issue25009@psf.upfronthosting.co.za>
2015-09-05 17:12:53Alex.Willmerlinkissue25009 messages
2015-09-05 17:12:53Alex.Willmercreate