[New-bugs-announce] [issue47134] Document the meaning of the number in OverflowError
Steven D'Aprano
report at bugs.python.org
Sat Mar 26 18:10:10 EDT 2022
New submission from Steven D'Aprano <steve+python at pearwood.info>:
OverflowError sometimes (but not always) includes some sort of numeric code:
>>> 1e+300 ** 2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: (34, 'Numerical result out of range')
but the meaning of the 34 is not documented:
https://docs.python.org/3/library/exceptions.html#OverflowError
help(OverflowError) is no more insightful, saying only:
__init__(self, /, *args, **kwargs)
Initialize self. See help(type(self)) for accurate signature.
Other OverflowError exceptions do not include the numeric code:
>>> math.exp(10000)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: math range error
Is it an error code from C? Something to do with the number of digits of precision? An easter-egg to do with The Count Of Monte Cristo?
----------
assignee: docs at python
components: Documentation
messages: 416093
nosy: docs at python, steven.daprano
priority: normal
severity: normal
status: open
title: Document the meaning of the number in OverflowError
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47134>
_______________________________________
More information about the New-bugs-announce
mailing list