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.

classification
Title: SystemError with deque
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: quiver, rhettinger
Priority: normal Keywords:

Created on 2004-10-16 23:05 by quiver, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
deque_demo.py quiver, 2004-10-16 23:05
Messages (4)
msg22711 - (view) Author: George Yoshida (quiver) (Python committer) Date: 2004-10-16 23:05
If I run the following script, it causes a SystemError.
# start of program
from collections import deque

d1 = deque()
d2 = deque()

class A:
    def __eq__(self, other):
        d1.pop()
        d1.appendleft(1)
        return 1

d1.extend((0, 1))
d2.extend((A(), 1))

d1 == d2
# end of program

$ python2.4 deque_demo.py
Traceback (most recent call last):
  File "deque_demo.py", line 15, in ?
    d1 == d2
SystemError: error return without exception set

This error happens if
- __eq__ returns values that are interpreted as True.
- appendleft is used insted of append.

Tested on Python 2.4a3(Win) and python2.4 from CVS 
as of 2004/10/15.

I attached this program for convenience.
msg22712 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-10-17 01:03
Logged In: YES 
user_id=80475

I think that has been fixed.  Please reverify with Py2.4b1
when it comes out.
msg22713 - (view) Author: George Yoshida (quiver) (Python committer) Date: 2004-10-18 01:40
Logged In: YES 
user_id=671362

I've verified that recent Python raises "RuntimeError : 
deque mutated during iteration" against my program.

Thanks Raymond.

Before submitting this, I tested on Cygwin and it looks like 
my Cygwin had a problem with libinstall.
That is why not all the libraries were installed properly in
the process of "make install".

Sorry about that.
msg22714 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-10-18 03:32
Logged In: YES 
user_id=80475

I appreciate the efforts to break the new tools and review
all the docs. Keep up the good work.
History
Date User Action Args
2022-04-11 14:56:07adminsetgithub: 41030
2004-10-16 23:05:54quivercreate