[issue33585] re.sub calls repl function one time too many for catch-all regex

2018-05-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This change is documented in the subsection "Changes in the Python API" of the section "Porting to Python 3.7". -- ___ Python tracker

[issue33585] re.sub calls repl function one time too many for catch-all regex

2018-05-20 Thread Ville Skyttä
Ville Skyttä added the comment: Oh, I see, sorry about the noise, then. (Only looked at the "Improved Modules" -> re section in the what's new, thus missed the doc.) -- ___ Python tracker

[issue33585] re.sub calls repl function one time too many for catch-all regex

2018-05-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is expected behavior and documented change in 3.7. The pattern ".*" can match an empty string, and it matches an empty string at the end of line. This behavior is consistent with the behavior of re.finditer() and with the

[issue33585] re.sub calls repl function one time too many for catch-all regex

2018-05-20 Thread Ville Skyttä
Ville Skyttä added the comment: Right, it's not limited to repl functions. Python 3.6.3: $ python -c 'import re;print(re.sub(".*", "X", "foo"))' X Python 3.7.0b4+: $ python -c 'import re;print(re.sub(".*", "X", "foo"))' XX Poking serhiy.storchaka who according to the

[issue33585] re.sub calls repl function one time too many for catch-all regex

2018-05-20 Thread Ville Skyttä
Change by Ville Skyttä : -- components: +Regular Expressions nosy: +ezio.melotti, mrabarnett ___ Python tracker ___

[issue33585] re.sub calls repl function one time too many for catch-all regex

2018-05-20 Thread Ville Skyttä
New submission from Ville Skyttä : (I'm fairly certain that the title doesn't describe the actual underlying issue all that well, however it is what I'm seeing so going with that for now.) Compared to Python 3.6, 3.7 appears to call the repl function for re.sub one time