Gregory P. Smith added the comment:
thanks. btw an alternative type check to consider in these situations:
PyIndex_Check
https://docs.python.org/2/c-api/number.html#c.PyIndex_Check
but what you wrote works.
--
nosy: +gregory.p.smith
___
Python
New submission from Ryan Gonzalez:
This should work (but doesn't):
Python 2.7.8+ (2.7:63dc1e32b715, Sep 30 2014, 19:24:46)
[GCC 4.2.1 Compatible Clang 3.5.0 (207381)] on linux2
Type help, copyright, credits or license for more information.
import re
re.match('(foo)', 'foo').group(1L)
Steven D'Aprano added the comment:
As I explained on the thread (possibly my post crossed in the mail with Ryan's
patch) I don't believe this is a bug fix. MatchObject.group has only accepted
actual ints, not longs, since Python 1.5 (tested 1.5, 2.4-2.7). Nor is there
any requirement to
Guido van Rossum added the comment:
I haven't seen the fix, but any place where an int is accepted but a long is
not, is a bug. The language has been on a long trip to making the two types
interchangeable and this seems one of the last remnants.
--
nosy: +gvanrossum
Roundup Robot added the comment:
New changeset 30f72ed73c3b by Benjamin Peterson in branch '2.7':
allow longs as indexes to group() (closes #22530)
https://hg.python.org/cpython/rev/30f72ed73c3b
--
nosy: +python-dev
resolution: not a bug - fixed
stage: - resolved
status: open - closed