You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ValueError: Exceeds the limit (4300) for integer string conversion:
2000
+
value has 5432 digits; use sys.set_int_max_str_digits()
2001
+
to increase the limit.
2002
+
```
2003
+
2004
+
#### 💡 Explanation:
2005
+
This call to `int()` works fine in Python 3.10.6 and raises a ValueError in Python 3.10.8. Note that Python can still work with large integers. The error is only raised when converting between integers and strings.
2006
+
2007
+
Fortunately, you can increase the limit for the allowed number of digits when you expect an operation to exceed it. To do this, you can use one of the following:
2008
+
- The -X int_max_str_digits command-line flag
2009
+
- The set_int_max_str_digits() function from the sys module
2010
+
- The PYTHONINTMAXSTRDIGITS environment variable
2011
+
2012
+
[Check the documentation](https://docs.python.org/3/library/stdtypes.html#int-max-str-digits) for more details on changing the default limit if you expect your code to exceed this value.
2013
+
2014
+
1979
2015
---
1980
2016
2017
+
1981
2018
## Section: Slippery Slopes
1982
2019
1983
2020
### ▶ Modifying a dictionary while iterating over it
0 commit comments