3 ms·
> Especially since a random library can just set the cap to 0 and side-step the problem entirely. Until another random library sets it to its preferred value (
by Someone 4y ago
> Especially since a random library can just set the cap to 0 and side-step the problem entirely.
Until another random library sets it to its preferred value (see https://news.ycombinator.com/item?id=32738206 https://news.ycombinator.com/item?id=32738206 for a similar issue with a CPU flag for supporting IEEE subnormals)
We might end up with libraries that keep setting that global to the value they need on every call into them.
- mywittyname 4y agoOh fun. Just what Python needs more of, this... try: value = int(value_to_parse) except ValueError: import sys __old_int_max_str_digits = sys.get_int_max_str_digits() sys.set_int_max_str_digits(0) value = int(value_to_parse) sys.set_int_max_str_digits(__old_int_max_str_digits) Or maybe just this: class UnboundedIntParsing: def __enter__(self): self.__old_int_max_str_digits = sys.get_int_max_str_digits() return self def __exit__(self, *args): sys.set_int_max_str_digits(self.__old_int_max_str_digits) with UnboundedIntParsing as uip: value = int(str_value)
- dmurray 4y agoNeeds to be made thread safe!
- sidewndr46 4y agoYeah, I like the context manager version of this. That way it's maintainable!