You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SystemError when __len__ returns a non-number #49387
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/benjaminp'closed_at=<Date2009-02-08.21:07:56.269>created_at=<Date2009-02-03.04:45:14.792>labels= ['type-crash', 'release-blocker']
title='SystemError when __len__ returns a non-number'updated_at=<Date2009-02-10.06:55:34.148>user='https://github.com/rhettinger'
Activity
rhettinger commentedon Feb 3, 2009
len(obj) is not happy when obj.__len__() returns a non-number.
benjaminp commentedon Feb 7, 2009
Here's patch that raises a TypeError like 2.x.
pitrou commentedon Feb 8, 2009
Wouldn't it be better to use PyNumber_AsSsize_t() instead, so as to
support all __index__-enabled objects?
benjaminp commentedon Feb 8, 2009
Yes, good idea.
pitrou commentedon Feb 8, 2009
I don't think you need to call PyNumber_Check() (unless you want to
customize the error message).
pitrou commentedon Feb 8, 2009
The patch is ok to me. (I assume all tests pass fine :-))
benjaminp commentedon Feb 8, 2009
Thanks for the reviews! Fixed in r69451.
hagen commentedon Feb 10, 2009
This also solves bpo-3729.