changeset: 105483:5904d2ced3d8 parent: 105481:e6ad41a3f3bd parent: 105482:1b162d6e3d01 user: Serhiy Storchaka date: Tue Dec 06 19:25:19 2016 +0200 files: Doc/library/re.rst Doc/whatsnew/3.6.rst Doc/whatsnew/3.7.rst Lib/sre_parse.py Lib/test/test_re.py Misc/NEWS description: Merge documentation for issue #27030 from 3.6. diff -r e6ad41a3f3bd -r 5904d2ced3d8 Doc/library/re.rst --- a/Doc/library/re.rst Tue Dec 06 16:27:24 2016 +0100 +++ b/Doc/library/re.rst Tue Dec 06 19:25:19 2016 +0200 @@ -758,7 +758,12 @@ Unmatched groups are replaced with an empty string. .. versionchanged:: 3.6 - Unknown escapes consisting of ``'\'`` and an ASCII letter now are errors. + Unknown escapes in *pattern* consisting of ``'\'`` and an ASCII letter + now are errors. + + .. versionchanged:: 3.7 + Unknown escapes in *repl* consisting of ``'\'`` and an ASCII letter + now are errors. .. function:: subn(pattern, repl, string, count=0, flags=0) diff -r e6ad41a3f3bd -r 5904d2ced3d8 Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst Tue Dec 06 16:27:24 2016 +0100 +++ b/Doc/whatsnew/3.6.rst Tue Dec 06 19:25:19 2016 +0200 @@ -2021,8 +2021,9 @@ ------------------------ * Unknown escapes consisting of ``'\'`` and an ASCII letter in - regular expressions will now cause an error. The :const:`re.LOCALE` - flag can now only be used with binary patterns. + regular expressions will now cause an error. In replacement templates for + :func:`re.sub` they are still allowed, but deprecated. + The :const:`re.LOCALE` flag can now only be used with binary patterns. * ``inspect.getmoduleinfo()`` was removed (was deprecated since CPython 3.3). :func:`inspect.getmodulename` should be used for obtaining the module diff -r e6ad41a3f3bd -r 5904d2ced3d8 Doc/whatsnew/3.7.rst --- a/Doc/whatsnew/3.7.rst Tue Dec 06 16:27:24 2016 +0100 +++ b/Doc/whatsnew/3.7.rst Tue Dec 06 19:25:19 2016 +0200 @@ -116,6 +116,11 @@ Removed ======= +API and Feature Removals +------------------------ + +* Unknown escapes consisting of ``'\'`` and an ASCII letter in replacement + templates for :func:`re.sub` will now cause an error. Porting to Python 3.7 diff -r e6ad41a3f3bd -r 5904d2ced3d8 Misc/NEWS --- a/Misc/NEWS Tue Dec 06 16:27:24 2016 +0100 +++ b/Misc/NEWS Tue Dec 06 19:25:19 2016 +0200 @@ -165,6 +165,9 @@ Library ------- +- Issue #27030: Unknown escapes consisting of ``'\'`` and an ASCII letter in + re.sub() replacement templates regular expressions now are errors. + - Issue #28835: Fix a regression introduced in warnings.catch_warnings(): call warnings.showwarning() if it was overriden inside the context manager.