[Python-bugs-list] [ python-Bugs-420343 ] SystemError from tuple() builtin
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 30 Apr 2001 19:18:03 -0700
Bugs item #420343, was updated on 2001-04-30 19:18
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=420343&group_id=5470
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Greg Chapman (glchapman)
Assigned to: Nobody/Anonymous (nobody)
Summary: SystemError from tuple() builtin
Initial Comment:
The following produces a SystemError under Python 2.1:
>>> class Test:
... def __init__(self):
... self.list = [1]
... def __len__(self):
... return 0
... def __getitem__(self, index):
... return self.list[index]
...
>>> t = Test()
>>> tuple(t)
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
SystemError: C:\USERS\greg\PROG\CPP\PYTHON\Python-2.1
\Objects\tupleobject.c:506: bad argument to internal
function
The problem is the call made by PySequence_Tuple to
_PyTuple_Resize. The above code results in an attempt
to resize the empty tuple, the ref count of which is
greater than 1.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=420343&group_id=5470