|
10鱼币
本帖最后由 一点沙 于 2023-1-24 16:13 编辑
小甲鱼在《零基础入门学习Python》第一版里第006讲里的动动手第1道题的答案说系统会输出Memory Overflow 那为啥我的报错了呢???
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
print(2 ** 2 ** 32)
ValueError: Exceeds the limit (4300) for integer string conversion; use sys.set_int_max_str_digits() to increase the limit
这是 3.11 版本新增的功能,限制(除了2的整次幂进制)的数字字符串和整数表示之间的转换的最大长度(即:禁止将太长的数字字符串转换为整型或反之)来减小拒绝服务攻击的攻击面
https://docs.python.org/3/library/stdtypes.html#integer-string-conversion-length-limitation
|
最佳答案
查看完整内容
这是 3.11 版本新增的功能,限制(除了2的整次幂进制)的数字字符串和整数表示之间的转换的最大长度(即:禁止将太长的数字字符串转换为整型或反之)来减小拒绝服务攻击的攻击面
https://docs.python.org/3/library/stdtypes.html#integer-string-conversion-length-limitation
|