]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-36502: Correct documentation of str.isspace() (GH-15019) (GH-15296)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 19 Aug 2019 10:10:14 +0000 (03:10 -0700)
committerGitHub <noreply@github.com>
Mon, 19 Aug 2019 10:10:14 +0000 (03:10 -0700)
commit0fcdd8d6d67f57733203fc79e6a07a89b924a390
treee61748e0b3bb2f1f4031fc3c904aec8a8e962dd3
parent316acf27045174bf090fa5f0000eae6801e0d322
bpo-36502: Correct documentation of str.isspace() (GH-15019) (GH-15296)

The documented definition was much broader than the real one:
there are tons of characters with general category "Other",
and we don't (and shouldn't) treat most of them as whitespace.

Rewrite the definition to agree with the comment on
_PyUnicode_IsWhitespace, and with the logic in makeunicodedata.py,
which is what generates that function and so ultimately governs.

Add suitable breadcrumbs so that a reader who wants to pin down
exactly what this definition means (what's a "bidirectional class"
of "B"?) can do so.  The `unicodedata` module documentation is an
appropriate central place for our references to Unicode's own copious
documentation, so point there.

Also add to the isspace() test a thorough check that the
implementation agrees with the intended definition.
(cherry picked from commit 8c1c426a631ba02357112657193f82c58d3e08b4)

Co-authored-by: Greg Price <gnprice@gmail.com>
Doc/library/stdtypes.rst
Lib/test/test_unicode.py