[issue22362] Warn about octal escapes > 0o377 in re

STINNER Victor report at bugs.python.org
Fri Sep 12 09:36:30 CEST 2014


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 numbers.

>>> -3 & 0xff
253

Before, "& 0xff" also converted negative numbers to positive in range 0..255.

----------
nosy: +haypo

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22362>
_______________________________________


More information about the Python-bugs-list mailing list