当算术运算的结果太大而无法表示时引发。对于整数来说,这种情况不会发生(这宁愿引发 MemoryError 而不是放弃)。但是,由于历史原因,有时会因超出所需范围的整数而引发 OverflowError。由于 C 语言中浮点异常处理缺乏标准化,因此大多数浮点运算都不会被检查。
Google Translate · 此内容为自动翻译。技术术语及适用条件请以英文原文为准。
官方说明 · 原文
Raised when the result of an arithmetic operation is too large to be represented. This cannot occur for integers (which would rather raise MemoryError than give up). However, for historical reasons, OverflowError is sometimes raised for integers that are outside a required range. Because of the lack of standardization of floating-point exception handling in C, most floating-point operations are not checked.
修改记录:English prose extracted; whitespace normalized; Korean context and classified official links added. Python code examples not redistributed. 译文说明已标注为自动翻译。