all Python 3Exceptionsexception
decimal.Overflow
module exceptions
The exponent of a decimal result exceeded the context maximum.
Syntax
raise decimal.Overflow
This is not the built-in OverflowError: catch decimal.Overflow itself (or the shared ArithmeticError base). The threshold is the current context's Emax, which defaults to 999999, so you normally only meet this signal after deliberately narrowing the context. Its trap is enabled by default; with the trap off the result is either Infinity or the largest finite number, depending on the rounding mode in effect.
Examples
import decimal
try:
raise decimal.Overflow
except decimal.Overflow as e:
print(type(e).__name__) # → Overflow
See also
Open in the full glossarydocs.python.orgReport an inaccuracy