[New-bugs-announce] [issue15988] Inconsistency in overflow error messages of integer argument

Serhiy Storchaka report at bugs.python.org
Thu Sep 20 20:51:10 CEST 2012


New submission from Serhiy Storchaka:

PyArg_ParseTuple raises inconsistent overflow error messages for small integer formats. For example:

>>> import _testcapi
>>> _testcapi.getargs_b(100)
100
>>> _testcapi.getargs_b(1000)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: unsigned byte integer is greater than maximum
>>> _testcapi.getargs_b(-1000)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: unsigned byte integer is less than minimum
>>> _testcapi.getargs_b(100000000000000000000)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: Python int too large to convert to C long
>>> _testcapi.getargs_b(-100000000000000000000)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: Python int too large to convert to C long

On platforms with 32-bit int and 64-bit long there will be more such cases.

----------
components: Interpreter Core
messages: 170827
nosy: storchaka
priority: low
severity: normal
status: open
title: Inconsistency in overflow error messages of integer argument
type: enhancement
versions: Python 3.4

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


More information about the New-bugs-announce mailing list