Message226570
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 highest bit. Such escaping is not portable across different regular exception engines.
I propose to add a warning when octal escape value is larger than 0o377. Here is preliminary patch which adds UserWarning. Or may be better to emit DeprecationWarning and then replace it by ValueError in future releases? |
|
Date |
User |
Action |
Args |
2014-09-08 11:07:20 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, pitrou, ezio.melotti, mrabarnett |
2014-09-08 11:07:20 | serhiy.storchaka | set | messageid: <1410174440.93.0.911211496637.issue22362@psf.upfronthosting.co.za> |
2014-09-08 11:07:20 | serhiy.storchaka | link | issue22362 messages |
2014-09-08 11:07:20 | serhiy.storchaka | create | |
|