Message289781
| Author |
serhiy.storchaka |
| Recipients |
mark.dickinson, rhettinger, serhiy.storchaka |
| Date |
2017年03月17日.20:27:26 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1489782446.56.0.355449112547.issue29840@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
For now bool() raises OverflowError if __bool__ is not defined and __len__ returns large value.
>>> class A:
... def __len__(self):
... return 1 << 1000
...
>>> bool(A())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: cannot fit 'int' into an index-sized integer
>>> bool(range(1<<1000))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: Python int too large to convert to C ssize_t
Proposed patch makes bool() returning True if len() raises OverflowError.
This is an alternate solution of issue28876. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2017年03月17日 20:27:26 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, mark.dickinson |
| 2017年03月17日 20:27:26 | serhiy.storchaka | set | messageid: <1489782446.56.0.355449112547.issue29840@psf.upfronthosting.co.za> |
| 2017年03月17日 20:27:26 | serhiy.storchaka | link | issue29840 messages |
| 2017年03月17日 20:27:26 | serhiy.storchaka | create |
|