[New-bugs-announce] [issue31969] re.groups() is not checking the arguments

Narendra report at bugs.python.org
Tue Nov 7 08:14:30 EST 2017


New submission from Narendra <cnrprfnl at gmail.com>:

Hi Team,

I have observed a bug in re.groups() function behavior in Python as below:

Issue:
re.groups() is not validating the arguments

Example:
>>> m = re.match(r'(\w+)@(\w+)\.(\w+)','username at hackerrank.com')
>>> m.groups()
('username', 'hackerrank', 'com')
>>> m.groups(1)
('username', 'hackerrank', 'com')
>>> m.groups(100000000000)
('username', 'hackerrank', 'com')
>>>

>From the above, its clear that re.groups() and re.groups(<somevalue>) both are same. I think re.groups() is not validating the arguments.

Please review the same and provide your comments whether my views are correct or wrong

----------
components: Regular Expressions
messages: 305751
nosy: ezio.melotti, mrabarnett, narendrac
priority: normal
severity: normal
status: open
title: re.groups() is not checking the arguments
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31969>
_______________________________________


More information about the New-bugs-announce mailing list