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

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


Disregard my last message, I was looking at the wrong code.

But looking at what I think is the right code
(https://hg.python.org/cpython/file/d49b9c8ee8ed/Modules), I am
confused, since this error is raised after the index has already been
converted to a Py_ssize_t.

On Tue, Sep 30, 2014, at 16:06, random832 at fastmail.us wrote:
> 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.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/


-- 
Random832


More information about the Python-ideas mailing list