diff --git a/.gitattributes b/.gitattributes
index 5eead664898..9ec17d12406 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -27,9 +27,6 @@ Lib/test/test_email/data/*.txt -text
Lib/test/xmltestdata/* -text
Lib/test/coding20731.py -text
-# Special files in third party code
-Modules/zlib/zlib.map -text
-
# CRLF files
*.bat text eol=crlf
*.ps1 text eol=crlf
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 00000000000..8e0647fdc1f
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1,53 @@
+# See https://help.github.com/articles/about-codeowners/
+# for more info about CODEOWNERS file
+
+# It uses the same pattern rule for gitignore file
+# https://git-scm.com/docs/gitignore#_pattern_format
+
+# asyncio
+**/*asyncio* @1st1
+
+# Core
+**/*genobject* @1st1
+
+# Hashing
+**/*hashlib* @python/crypto-team
+**/*pyhash* @python/crypto-team
+
+# Import (including importlib)
+**/*import* @python/import-team
+
+# SSL
+**/*ssl* @python/crypto-team
+
+# CSPRNG
+Python/bootstrap_hash.c @python/crypto-team
+
+# Email and related
+**/*mail* @python/email-team
+**/*smtp* @python/email-team
+**/*mime* @python/email-team
+**/*imap* @python/email-team
+**/*poplib* @python/email-team
+
+# subprocess
+**/*subprocess* @gpshead
+
+# Windows
+/PC/ @python/windows-team
+/PCbuild/ @python/windows-team
+
+# Windows installer packages
+/Tools/msi/ @python/windows-team
+/Tools/nuget/ @python/windows-team
+
+**/*itertools* @rhettinger
+**/*collections* @rhettinger
+**/*random* @rhettinger
+**/*queue* @rhettinger
+**/*bisect* @rhettinger
+**/*heapq* @rhettinger
+**/*functools* @ncoghlan @rhettinger
+**/*decimal* @rhettinger @skrah
+
+**/*idlelib* @terryjreedy
diff --git a/.github/CODE_OF_CONDUCT.rst b/.github/CODE_OF_CONDUCT.rst
new file mode 100644
index 00000000000..28de97ced16
--- /dev/null
+++ b/.github/CODE_OF_CONDUCT.rst
@@ -0,0 +1,14 @@
+Code of Conduct
+===============
+
+Please note that all interactions on
+`Python Software Foundation Salut! Cela ressemble à un excellent
-
recipie
déjeuner.
`` |
+ | in a string passed to the *repl* | * ``\g
`` |
| argument of ``re.sub()`` | * ``\g<1>`` |
| | * ``\1`` |
+---------------------------------------+----------------------------------+
@@ -289,18 +319,18 @@ The special characters are:
``(?=...)``
Matches if ``...`` matches next, but doesn't consume any of the string. This is
- called a lookahead assertion. For example, ``Isaac (?=Asimov)`` will match
+ called a :dfn:`lookahead assertion`. For example, ``Isaac (?=Asimov)`` will match
``'Isaac '`` only if it's followed by ``'Asimov'``.
``(?!...)``
- Matches if ``...`` doesn't match next. This is a negative lookahead assertion.
+ Matches if ``...`` doesn't match next. This is a :dfn:`negative lookahead assertion`.
For example, ``Isaac (?!Asimov)`` will match ``'Isaac '`` only if it's *not*
followed by ``'Asimov'``.
``(?<=...)``
Matches if the current position in the string is preceded by a match for ``...``
that ends at the current position. This is called a :dfn:`positive lookbehind
- assertion`. ``(?<=abc)def`` will find a match in ``abcdef``, since the
+ assertion`. ``(?<=abc)def`` will find a match in ``'abcdef'``, since the
lookbehind will back up 3 characters and check if the contained pattern matches.
The contained pattern must only match strings of some fixed length, meaning that
``abc`` or ``a|b`` are allowed, but ``a*`` and ``a{3,4}`` are not. Note that
@@ -358,44 +388,41 @@ character ``'$'``.
``\b``
Matches the empty string, but only at the beginning or end of a word.
- A word is defined as a sequence of Unicode alphanumeric or underscore
- characters, so the end of a word is indicated by whitespace or a
- non-alphanumeric, non-underscore Unicode character. Note that formally,
+ A word is defined as a sequence of word characters. Note that formally,
``\b`` is defined as the boundary between a ``\w`` and a ``\W`` character
(or vice versa), or between ``\w`` and the beginning/end of the string.
This means that ``r'\bfoo\b'`` matches ``'foo'``, ``'foo.'``, ``'(foo)'``,
``'bar foo baz'`` but not ``'foobar'`` or ``'foo3'``.
- By default Unicode alphanumerics are the ones used, but this can be changed
- by using the :const:`ASCII` flag. Inside a character range, ``\b``
- represents the backspace character, for compatibility with Python's string
- literals.
+ By default Unicode alphanumerics are the ones used in Unicode patterns, but
+ this can be changed by using the :const:`ASCII` flag. Word boundaries are
+ determined by the current locale if the :const:`LOCALE` flag is used.
+ Inside a character range, ``\b`` represents the backspace character, for
+ compatibility with Python's string literals.
``\B``
Matches the empty string, but only when it is *not* at the beginning or end
of a word. This means that ``r'py\B'`` matches ``'python'``, ``'py3'``,
``'py2'``, but not ``'py'``, ``'py.'``, or ``'py!'``.
- ``\B`` is just the opposite of ``\b``, so word characters are
- Unicode alphanumerics or the underscore, although this can be changed
- by using the :const:`ASCII` flag.
+ ``\B`` is just the opposite of ``\b``, so word characters in Unicode
+ patterns are Unicode alphanumerics or the underscore, although this can
+ be changed by using the :const:`ASCII` flag. Word boundaries are
+ determined by the current locale if the :const:`LOCALE` flag is used.
``\d``
For Unicode (str) patterns:
Matches any Unicode decimal digit (that is, any character in
Unicode character category [Nd]). This includes ``[0-9]``, and
also many other digit characters. If the :const:`ASCII` flag is
- used only ``[0-9]`` is matched (but the flag affects the entire
- regular expression, so in such cases using an explicit ``[0-9]``
- may be a better choice).
+ used only ``[0-9]`` is matched.
+
For 8-bit (bytes) patterns:
Matches any decimal digit; this is equivalent to ``[0-9]``.
``\D``
- Matches any character which is not a Unicode decimal digit. This is
+ Matches any character which is not a decimal digit. This is
the opposite of ``\d``. If the :const:`ASCII` flag is used this
- becomes the equivalent of ``[^0-9]`` (but the flag affects the entire
- regular expression, so in such cases using an explicit ``[^0-9]`` may
- be a better choice).
+ becomes the equivalent of ``[^0-9]``.
``\s``
For Unicode (str) patterns:
@@ -403,39 +430,36 @@ character ``'$'``.
``[ \t\n\r\f\v]``, and also many other characters, for example the
non-breaking spaces mandated by typography rules in many
languages). If the :const:`ASCII` flag is used, only
- ``[ \t\n\r\f\v]`` is matched (but the flag affects the entire
- regular expression, so in such cases using an explicit
- ``[ \t\n\r\f\v]`` may be a better choice).
+ ``[ \t\n\r\f\v]`` is matched.
For 8-bit (bytes) patterns:
Matches characters considered whitespace in the ASCII character set;
this is equivalent to ``[ \t\n\r\f\v]``.
``\S``
- Matches any character which is not a Unicode whitespace character. This is
+ Matches any character which is not a whitespace character. This is
the opposite of ``\s``. If the :const:`ASCII` flag is used this
- becomes the equivalent of ``[^ \t\n\r\f\v]`` (but the flag affects the entire
- regular expression, so in such cases using an explicit ``[^ \t\n\r\f\v]`` may
- be a better choice).
+ becomes the equivalent of ``[^ \t\n\r\f\v]``.
``\w``
For Unicode (str) patterns:
Matches Unicode word characters; this includes most characters
that can be part of a word in any language, as well as numbers and
the underscore. If the :const:`ASCII` flag is used, only
- ``[a-zA-Z0-9_]`` is matched (but the flag affects the entire
- regular expression, so in such cases using an explicit
- ``[a-zA-Z0-9_]`` may be a better choice).
+ ``[a-zA-Z0-9_]`` is matched.
+
For 8-bit (bytes) patterns:
Matches characters considered alphanumeric in the ASCII character set;
- this is equivalent to ``[a-zA-Z0-9_]``.
+ this is equivalent to ``[a-zA-Z0-9_]``. If the :const:`LOCALE` flag is
+ used, matches characters considered alphanumeric in the current locale
+ and the underscore.
``\W``
- Matches any character which is not a Unicode word character. This is
+ Matches any character which is not a word character. This is
the opposite of ``\w``. If the :const:`ASCII` flag is used this
- becomes the equivalent of ``[^a-zA-Z0-9_]`` (but the flag affects the
- entire regular expression, so in such cases using an explicit
- ``[^a-zA-Z0-9_]`` may be a better choice).
+ becomes the equivalent of ``[^a-zA-Z0-9_]``. If the :const:`LOCALE` flag is
+ used, matches characters considered alphanumeric in the current locale
+ and the underscore.
``\Z``
Matches only at the end of the string.
@@ -443,15 +467,15 @@ character ``'$'``.
Most of the standard escapes supported by Python string literals are also
accepted by the regular expression parser::
- \a \b \f \n \N
- \r \t \u \U
- \v \x \\
+ \a \b \f \n
+ \N \r \t \u
+ \U \v \x \\
(Note that ``\b`` is used to represent word boundaries, and means "backspace"
only inside character classes.)
``'\u'``, ``'\U'``, and ``'\N'`` escape sequences are only recognized in Unicode
-patterns. In bytes patterns they are not treated specially.
+patterns. In bytes patterns they are errors.
Octal escapes are included in a limited form. If the first digit is a 0, or if
there are three octal digits, it is considered an octal escape. Otherwise, it is
@@ -493,9 +517,10 @@ form.
.. function:: compile(pattern, flags=0)
- Compile a regular expression pattern into a regular expression object, which
- can be used for matching using its :func:`~regex.match` and
- :func:`~regex.search` methods, described below.
+ Compile a regular expression pattern into a :ref:`regular expression object
+
Format | Packed as .zip | Packed as .tar.bz2 | ||
---|---|---|---|---|
PDF (US-Letter paper size) | -Download (ca. 8 MB) | -Download (ca. 8 MB) | +Download (ca. 13 MiB) | +Download (ca. 13 MiB) |
PDF (A4 paper size) | -Download (ca. 8 MB) | -Download (ca. 8 MB) | +Download (ca. 13 MiB) | +Download (ca. 13 MiB) |
HTML | -Download (ca. 6 MB) | -Download (ca. 4 MB) | +Download (ca. 9 MiB) | +Download (ca. 6 MiB) |
Plain Text | -Download (ca. 2 MB) | -Download (ca. 1.5 MB) | +Download (ca. 3 MiB) | +Download (ca. 2 MiB) |
EPUB | -Download (ca. 4.5 MB) | +Download (ca. 5 MiB) |
{% trans %}Download these documents{% endtrans %}