diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-02-03 09:04:19 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-02-03 09:04:19 (GMT) |
commit | 83e802796c80f46be616b48020356f7f51be533d (patch) | |
tree | e896b143abc3523f96e20d88ebcc22512af16aa7 /Doc/whatsnew | |
parent | 32ca3dcb97a75c05dc2b90c88bbf82a541c57c61 (diff) | |
download | cpython-83e802796c80f46be616b48020356f7f51be533d.zip cpython-83e802796c80f46be616b48020356f7f51be533d.tar.gz cpython-83e802796c80f46be616b48020356f7f51be533d.tar.bz2 |
Issue #22818: Splitting on a pattern that could match an empty string now
raises a warning. Patterns that can only match empty strings are now
rejected.
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/3.5.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst index c309aa8..f7b9a83 100644 --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -482,6 +482,13 @@ Changes in the Python API simply define :meth:`~importlib.machinery.Loader.create_module` to return ``None`` (:issue:`23014`). +* :func:`re.split` always ignored empty pattern matches, so the ``'x*'`` + pattern worked the same as ``'x+'``, and the ``'\b'`` pattern never worked. + Now :func:`re.split` raises a warning if the pattern could match + an empty string. For compatibility use patterns that never match an empty + string (e.g. ``'x+'`` instead of ``'x*'``). Patterns that could only match + an empty string (such as ``'\b'``) now raise an error. + Changes in the C API -------------------- |