Issue2001

classification
Title: deque.popleft() not thread-safe
Type: Severity: major
Components: Library Versions: Jython 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ajdavis, amak, fwierzbicki, zyasoft
Priority: normal Keywords:

Created on 2012-12-29.18:36:12 by ajdavis, last changed 2014-06-19.06:08:42 by zyasoft.

Files
File name Uploaded Description Edit Remove
deque_play.py ajdavis, 2012-12-29.18:36:11
Messages
msg7558 (view) Author: A. Jesse Jiryu Davis (ajdavis) Date: 2012-12-29.18:36:11
The deque docs say that "Deques support thread-safe, memory efficient appends and pops from either side of the deque", but deque.popleft() isn't thread-safe. Under some circumstances the attached script throws a NullPointerException:

Exception in thread Thread:Traceback (most recent call last):
  File "/Users/emptysquare/jython2.5.2/Lib/threading.py", line 179, in _Thread__bootstrap
    self.run()
  File "/Users/emptysquare/jython2.5.2/Lib/threading.py", line 170, in run
    self._target(*self._args, **self._kwargs)
  File "deque_play.py", line 9, in f
    q.popleft()
NullPointerException: java.lang.NullPointerException

... under others it simply throws "IndexError: pop from an empty deque". Either error is wrong and inconsistent with the docs and with CPython's behavior.
msg8721 (view) Author: Jim Baker (zyasoft) Date: 2014-06-19.06:08:42
Fixed as of http://hg.python.org/jython/rev/759e56cfcac7
History
Date User Action Args
2014-06-19 06:08:42zyasoftsetstatus: open -> closed
resolution: fixed
messages: + msg8721
nosy: + zyasoft
2013-02-20 00:25:21fwierzbickisetpriority: normal
versions: + Jython 2.7, - 2.5.2, 2.7a2
2013-02-09 13:56:58amaksetnosy: + amak
2012-12-30 18:28:15fwierzbickisetnosy: + fwierzbicki
2012-12-29 18:36:21ajdavissetversions: + 2.7a2
2012-12-29 18:36:12ajdaviscreate