[issue26068] re.compile() repr end quote truncated

2016-01-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: More smart truncating with closing quote and dots was the idea that I want to propose since introducing %R, but I didn't have time to formulate this. Opened issue26090 for this. -- ___ Python tracker

[issue26068] re.compile() repr end quote truncated

2016-01-11 Thread Ezio Melotti
Ezio Melotti added the comment: FTR the repr was added in #13592. -- nosy: +serhiy.storchaka type: -> behavior versions: +Python 3.5, Python 3.6 -Python 3.4 ___ Python tracker

[issue26068] re.compile() repr end quote truncated

2016-01-09 Thread ThiefMaster
ThiefMaster added the comment: Not eval'ing it, just wondered why the repr looks so weird when printing an object containing a compiled regex ;) -- ___ Python tracker

[issue26068] re.compile() repr end quote truncated

2016-01-09 Thread Emanuel Barry
Emanuel Barry added the comment: Truncating at 200 characters is actually a common occurrence in the C code, just barely anyone notice this, as it's not common to need more than 200 characters for most expressions. I don't think this needs to be changed at all; the rare case should not affect

[issue26068] re.compile() repr end quote truncated

2016-01-09 Thread ThiefMaster
ThiefMaster added the comment: Would it be possible to preserve the quotes even in case of truncation? -- ___ Python tracker ___

[issue26068] re.compile() repr end quote truncated

2016-01-09 Thread Guido van Rossum
Guido van Rossum added the comment: Yes, the C code pretty much always uses %., in order to protect itself from buffer overflows. Pulling off an unabbreviated str() here would be a major piece of work. -- ___ Python tracker

[issue26068] re.compile() repr end quote truncated

2016-01-09 Thread Guido van Rossum
Guido van Rossum added the comment: It's simply the effect of the "%.200R" format here: https://hg.python.org/cpython/file/default/Modules/_sre.c#l1417 I recommend not bothering to fix this: it would just be more code, and to what end? -- nosy: +gvanrossum

[issue26068] re.compile() repr end quote truncated

2016-01-09 Thread Guido van Rossum
Guido van Rossum added the comment: That would be an interesting exercise. You'd have to patch PyUnicode_FromFormat(). It would be nice to have this. It should probably also insert some dots (the universal sign to indicate that something was truncated). --

[issue26068] re.compile() repr end quote truncated

2016-01-09 Thread ThiefMaster
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)) ...

[issue26068] re.compile() repr end quote truncated

2016-01-09 Thread ThiefMaster
ThiefMaster added the comment: I think it's pretty ugly to have a repr that is valid python code in most cases and suddenly stops being so. The repr of a string is not truncated, so why truncate it in a pattern object? With the truncation, why not use a repr style that's clearly not

[issue26068] re.compile() repr end quote truncated

2016-01-09 Thread Matthew Barnett
Matthew Barnett added the comment: I'm going to have to agree with ThiefMaster. String literals don't truncate like that, nor do lists, nor tuples. Are there any similar cases of truncation elsewhere in the standard library? -- ___ Python tracker