[Python-ideas] Python 2's re module should take longs

random832 at fastmail.us random832 at fastmail.us
Tue Sep 30 22:06:23 CEST 2014


On Tue, Sep 30, 2014, at 15:31, Terry Reedy wrote:
> If groups were stored in a list, then technically, yes, not if groups 
> are stored in a dict to support named groups with just one structure.

Longs work fine interchangeably with ints in a dict. And even if they
didn't, the group function _could_ convert a small-valued long argument
to an int. This is an error raised by a function implemented in C that
forces a static type checking on its arguments. The core problem is that
the PyInt_AsLong function does not check (and handle) the case that its
argument is a small-valued PyLong.


More information about the Python-ideas mailing list