Roundup Robot added the comment:
New changeset 3b32f495fb38 by Serhiy Storchaka in branch 'default':
Issue #22362: Forbidden ambiguous octal escapes out of range 0-0o377 in
https://hg.python.org/cpython/rev/3b32f495fb38
--
nosy: +python-dev
___
Serhiy Storchaka added the comment:
Thanks Antoine and Victor for the review.
--
resolution: - fixed
stage: patch review - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22362
Serhiy Storchaka added the comment:
If this is error, should the patch be applied to maintained releases?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22362
___
Serhiy Storchaka added the comment:
Warning or exception? This is a question.
--
assignee: - serhiy.storchaka
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22362
___
STINNER Victor added the comment:
Warning or exception? This is a question.
Using -Werror, warnings raise exceptions :-)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22362
___
Antoine Pitrou added the comment:
This is an error, so it should really be an exception. There's no use case for
being lenient, IMO.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22362
STINNER Victor added the comment:
re_octal_escape_overflow_raise.patch: you should write a subfunction to not
repeat the error message 3 times.
+if c 0o377:
Hum, I never use octal. 255 instead of 0o377 would be less surprising :-p By
the way, you should also check for negative
Serhiy Storchaka added the comment:
By the way, you should also check for negative numbers.
Not in this case. You can't construct negative number from three octal digits.
--
___
Python tracker rep...@bugs.python.org
Antoine Pitrou added the comment:
I think we should simply raise ValueError in 3.5. There's no reason to accept
such invalid escapes.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22362
Serhiy Storchaka added the comment:
Well, here is a patch which makes re raise an exception on suspicious octals.
--
Added file:
http://bugs.python.org/file36602/re_octal_escape_overflow_raise.patch
___
Python tracker rep...@bugs.python.org
New submission from Serhiy Storchaka:
Currently the re module accepts octal escapes from \400 to \777, but ignore
highest bit.
re.search(r'\542', 'abc')
_sre.SRE_Match object; span=(1, 2), match='b'
This behavior looks surprising and is inconsistent with the regex module which
preserve
11 matches
Mail list logo