[New-bugs-announce] [issue28876] bool of large range raises OverflowError

Mark Dickinson report at bugs.python.org
Mon Dec 5 04:37:42 EST 2016


New submission from Mark Dickinson:

The bool of a large range raises OverflowError:

    >>> bool(range(2**63))
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    OverflowError: Python int too large to convert to C ssize_t

This is a side-effect of len raising OverflowError, which is a general problem that's nontrivial to fix (the sq_length slot is constrained to return a ssize_t). In theory, though, it would be possible to implement nb_bool for range objects to do the right thing.

In practice, this may well not be worth fixing, though I think it's at least worth reporting.

----------
components: Interpreter Core
messages: 282402
nosy: mark.dickinson
priority: normal
severity: normal
status: open
title: bool of large range raises OverflowError
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28876>
_______________________________________


More information about the New-bugs-announce mailing list