[Python-bugs-list] [ python-Bugs-575773 ] Negative __len__ provokes SystemError
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 25 Jul 2002 09:06:42 -0700
Bugs item #575773, was opened at 2002-06-30 22:27
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=575773&group_id=5470
Category: Python Interpreter Core
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Tony Lownds (tonylownds)
>Assigned to: Jeremy Hylton (jhylton)
Summary: Negative __len__ provokes SystemError
Initial Comment:
class A(object):
def __len__(self):
return -2 # anything < 0
def __getslice__(self, x, y):
pass
A()[-1:] # anything < 0
... results in....
Traceback (most recent call last):
File "cause_system_error.py", line 8, in ?
A()[-1:] # anything < 0
SystemError: error return without exception set
----------------------------------------------------------------------
>Comment By: Jeremy Hylton (jhylton)
Date: 2002-07-25 16:06
Message:
Logged In: YES
user_id=31392
Fixed in rev 2.162 of typeobject.c.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=575773&group_id=5470