[New-bugs-announce] [issue26068] re.compile() repr end quote truncated

ThiefMaster report at bugs.python.org
Sat Jan 9 16:18:18 EST 2016


New submission from ThiefMaster:

```
Python 3.4.3 (default, Jan  5 2016, 23:13:10)
[GCC 4.7.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> for n in range(198, 201):
...     print(re.compile('x' * n))
...
re.compile('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
re.compile('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
re.compile('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
```

The closing quote in the repr goes away once the regex exceeds a certain length. This smells like an off-by-one somewhere that results in the last character to be lost. In any case, it's pretty ugly since the repr clearly pretends to be executable Python code, which is not the case anymore with this quote missing.

----------
components: Regular Expressions
messages: 257860
nosy: ThiefMaster, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: re.compile() repr end quote truncated
versions: Python 3.4

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


More information about the New-bugs-announce mailing list