New submission from Alex Willmer: 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() ---------- components: Library (Lib) messages: 249914 nosy: Alex.Willmer priority: normal severity: normal status: open title: queue.Queue() does not validate the maxsize argument type: behavior versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25009> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com