Skip to content

Commit e5d54da

Browse files
committed
Merge branch 'master' into benjamin-pep-552
2 parents b3a7070 + 11cc289 commit e5d54da

File tree

232 files changed

+6177
-1532
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

232 files changed

+6177
-1532
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,8 @@ Python/bootstrap_hash.c @python/crypto-team
5050
**/*functools* @ncoghlan @rhettinger
5151
**/*decimal* @rhettinger @skrah
5252

53+
**/*dataclasses* @ericvsmith
54+
5355
**/*idlelib* @terryjreedy
56+
57+
**/*typing* @gvanrossum @ilevkivskyi

Doc/bugs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ taken on the bug.
6868

6969
.. seealso::
7070

71-
`How to Report Bugs Effectively <http://www.chiark.greenend.org.uk/~sgtatham/bugs.html>`_
71+
`How to Report Bugs Effectively <https://www.chiark.greenend.org.uk/~sgtatham/bugs.html>`_
7272
Article which goes into some detail about how to create a useful bug report.
7373
This describes what kind of information is useful and why it is useful.
7474

Doc/c-api/init.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ The following functions can be safely called before Python is initialized:
4040
* :c:func:`Py_GetCompiler`
4141
* :c:func:`Py_GetCopyright`
4242
* :c:func:`Py_GetPlatform`
43-
* :c:func:`Py_GetProgramName`
4443
* :c:func:`Py_GetVersion`
4544

4645
* Utilities:
@@ -59,8 +58,8 @@ The following functions can be safely called before Python is initialized:
5958
The following functions **should not be called** before
6059
:c:func:`Py_Initialize`: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`,
6160
:c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`,
62-
:c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` and
63-
:c:func:`PyEval_InitThreads`.
61+
:c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`,
62+
:c:func:`Py_GetProgramName` and :c:func:`PyEval_InitThreads`.
6463

6564

6665
.. _global-conf-vars:

Doc/conf.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,10 @@
9090
# Options for LaTeX output
9191
# ------------------------
9292

93+
latex_engine = 'xelatex'
94+
9395
# Get LaTeX to handle Unicode correctly
9496
latex_elements = {
95-
'inputenc': r'\usepackage[utf8x]{inputenc}',
96-
'utf8extra': '',
97-
'fontenc': r'\usepackage[T1,T2A]{fontenc}',
9897
}
9998

10099
# Additional stuff for the LaTeX preamble.

Doc/distutils/apiref.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,9 @@ the full reference.
286286
Distribution constructor. :func:`setup` creates a Distribution instance.
287287

288288
.. versionchanged:: 3.7
289-
:class:`~distutils.core.Distribution` now raises a :exc:`TypeError` if
290-
``classifiers``, ``keywords`` and ``platforms`` fields are not specified
291-
as a list.
289+
:class:`~distutils.core.Distribution` now warns if ``classifiers``,
290+
``keywords`` and ``platforms`` fields are not specified as a list or
291+
a string.
292292

293293
.. class:: Command
294294

Doc/faq/design.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ each Python stack frame. Also, extensions can call back into Python at almost
343343
random moments. Therefore, a complete threads implementation requires thread
344344
support for C.
345345

346-
Answer 2: Fortunately, there is `Stackless Python <http://www.stackless.com>`_,
346+
Answer 2: Fortunately, there is `Stackless Python <https://bitbucket.org/stackless-dev/stackless/wiki/Home>`_,
347347
which has a completely redesigned interpreter loop that avoids the C stack.
348348

349349

Doc/faq/gui.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ number of platforms, with Windows, Mac OS X, GTK, X11, all listed as
4343
current stable targets. Language bindings are available for a number
4444
of languages including Python, Perl, Ruby, etc.
4545

46-
wxPython (http://www.wxpython.org) is the Python binding for
46+
`wxPython <https://www.wxpython.org>`_ is the Python binding for
4747
wxwidgets. While it often lags slightly behind the official wxWidgets
4848
releases, it also offers a number of features via pure Python
4949
extensions that are not available in other language bindings. There
@@ -72,9 +72,9 @@ Gtk+
7272

7373
The `GObject introspection bindings <https://wiki.gnome.org/Projects/PyGObject>`_
7474
for Python allow you to write GTK+ 3 applications. There is also a
75-
`Python GTK+ 3 Tutorial <https://python-gtk-3-tutorial.readthedocs.org/en/latest/>`_.
75+
`Python GTK+ 3 Tutorial <https://python-gtk-3-tutorial.readthedocs.io>`_.
7676

77-
The older PyGtk bindings for the `Gtk+ 2 toolkit <http://www.gtk.org>`_ have
77+
The older PyGtk bindings for the `Gtk+ 2 toolkit <https://www.gtk.org>`_ have
7878
been implemented by James Henstridge; see <http://www.pygtk.org>.
7979

8080
Kivy

Doc/faq/library.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ Python program effectively only uses one CPU, due to the insistence that
419419
Back in the days of Python 1.5, Greg Stein actually implemented a comprehensive
420420
patch set (the "free threading" patches) that removed the GIL and replaced it
421421
with fine-grained locking. Adam Olsen recently did a similar experiment
422-
in his `python-safethread <http://code.google.com/p/python-safethread/>`_
422+
in his `python-safethread <https://code.google.com/archive/p/python-safethread>`_
423423
project. Unfortunately, both experiments exhibited a sharp drop in single-thread
424424
performance (at least 30% slower), due to the amount of fine-grained locking
425425
necessary to compensate for the removal of the GIL.

Doc/faq/programming.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ which don't. One is Thomas Heller's py2exe (Windows only) at
100100

101101
http://www.py2exe.org/
102102

103-
Another tool is Anthony Tuininga's `cx_Freeze <http://cx-freeze.sourceforge.net/>`_.
103+
Another tool is Anthony Tuininga's `cx_Freeze <https://anthony-tuininga.github.io/cx_Freeze/>`_.
104104

105105

106106
Are there coding standards or a style guide for Python programs?

Doc/faq/windows.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ offender.
170170
How do I make an executable from a Python script?
171171
-------------------------------------------------
172172

173-
See http://cx-freeze.sourceforge.net/ for a distutils extension that allows you
174-
to create console and GUI executables from Python code.
173+
See `cx_Freeze <https://anthony-tuininga.github.io/cx_Freeze/>`_ for a distutils extension
174+
that allows you to create console and GUI executables from Python code.
175175
`py2exe <http://www.py2exe.org/>`_, the most popular extension for building
176176
Python 2.x-based executables, does not yet support Python 3 but a version that
177177
does is in development.

Doc/glossary.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Glossary
126126

127127
BDFL
128128
Benevolent Dictator For Life, a.k.a. `Guido van Rossum
129-
<https://www.python.org/~guido/>`_, Python's creator.
129+
<https://gvanrossum.github.io/>`_, Python's creator.
130130

131131
binary file
132132
A :term:`file object` able to read and write

Doc/howto/curses.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ learn more about submitting patches to Python.
543543

544544
* `Writing Programs with NCURSES <http://invisible-island.net/ncurses/ncurses-intro.html>`_:
545545
a lengthy tutorial for C programmers.
546-
* `The ncurses man page <http://linux.die.net/man/3/ncurses>`_
546+
* `The ncurses man page <https://linux.die.net/man/3/ncurses>`_
547547
* `The ncurses FAQ <http://invisible-island.net/ncurses/ncurses.faq.html>`_
548548
* `"Use curses... don't swear" <https://www.youtube.com/watch?v=eN1eZtjLEnU>`_:
549549
video of a PyCon 2013 talk on controlling terminals using curses or Urwid.

Doc/howto/pyporting.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,4 +449,4 @@ to make sure everything functions as expected in both versions of Python.
449449

450450
.. _"What's New": https://docs.python.org/3/whatsnew/index.html
451451

452-
.. _Why Python 3 exists: http://www.snarky.ca/why-python-3-exists
452+
.. _Why Python 3 exists: https://snarky.ca/why-python-3-exists

Doc/howto/unicode.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ To help understand the standard, Jukka Korpela has written `an introductory
217217
guide <https://www.cs.tut.fi/~jkorpela/unicode/guide.html>`_ to reading the
218218
Unicode character tables.
219219

220-
Another `good introductory article <http://www.joelonsoftware.com/articles/Unicode.html>`_
220+
Another `good introductory article <https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/>`_
221221
was written by Joel Spolsky.
222222
If this introduction didn't make things clear to you, you should try
223223
reading this alternate article before continuing.
@@ -487,7 +487,7 @@ References
487487
Some good alternative discussions of Python's Unicode support are:
488488

489489
* `Processing Text Files in Python 3 <http://python-notes.curiousefficiency.org/en/latest/python3/text_file_processing.html>`_, by Nick Coghlan.
490-
* `Pragmatic Unicode <http://nedbatchelder.com/text/unipain.html>`_, a PyCon 2012 presentation by Ned Batchelder.
490+
* `Pragmatic Unicode <https://nedbatchelder.com/text/unipain.html>`_, a PyCon 2012 presentation by Ned Batchelder.
491491

492492
The :class:`str` type is described in the Python library reference at
493493
:ref:`textseq`.

Doc/library/email.generator.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ over channels that are not "8 bit clean".
5353
:data:`~email.policy.compat32` policy and ``False`` for all others).
5454
*mangle_from_* is intended for use when messages are stored in unix mbox
5555
format (see :mod:`mailbox` and `WHY THE CONTENT-LENGTH FORMAT IS BAD
56-
<http://www.jwz.org/doc/content-length.html>`_).
56+
<https://www.jwz.org/doc/content-length.html>`_).
5757

5858
If *maxheaderlen* is not ``None``, refold any header lines that are longer
5959
than *maxheaderlen*, or if ``0``, do not rewrap any headers. If
@@ -154,7 +154,7 @@ to be using :class:`BytesGenerator`, and not :class:`Generator`.
154154
:data:`~email.policy.compat32` policy and ``False`` for all others).
155155
*mangle_from_* is intended for use when messages are stored in unix mbox
156156
format (see :mod:`mailbox` and `WHY THE CONTENT-LENGTH FORMAT IS BAD
157-
<http://www.jwz.org/doc/content-length.html>`_).
157+
<https://www.jwz.org/doc/content-length.html>`_).
158158

159159
If *maxheaderlen* is not ``None``, refold any header lines that are longer
160160
than *maxheaderlen*, or if ``0``, do not rewrap any headers. If

Doc/library/hashlib.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ Keyed hashing
482482

483483
Keyed hashing can be used for authentication as a faster and simpler
484484
replacement for `Hash-based message authentication code
485-
<http://en.wikipedia.org/wiki/Hash-based_message_authentication_code>`_ (HMAC).
485+
<https://en.wikipedia.org/wiki/Hash-based_message_authentication_code>`_ (HMAC).
486486
BLAKE2 can be securely used in prefix-MAC mode thanks to the
487487
indifferentiability property inherited from BLAKE.
488488

@@ -699,7 +699,7 @@ implementation, extension code, and this documentation:
699699

700700
You should have received a copy of the CC0 Public Domain Dedication along
701701
with this software. If not, see
702-
http://creativecommons.org/publicdomain/zero/1.0/.
702+
https://creativecommons.org/publicdomain/zero/1.0/.
703703

704704
The following people have helped with development or contributed their changes
705705
to the project and the public domain according to the Creative Commons Public

Doc/library/othergui.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ available for Python:
1111
`PyGObject <https://wiki.gnome.org/Projects/PyGObject>`_
1212
PyGObject provides introspection bindings for C libraries using
1313
`GObject <https://developer.gnome.org/gobject/stable/>`_. One of
14-
these libraries is the `GTK+ 3 <http://www.gtk.org/>`_ widget set.
14+
these libraries is the `GTK+ 3 <https://www.gtk.org/>`_ widget set.
1515
GTK+ comes with many more widgets than Tkinter provides. An online
16-
`Python GTK+ 3 Tutorial <https://python-gtk-3-tutorial.readthedocs.org/en/latest/>`_
16+
`Python GTK+ 3 Tutorial <https://python-gtk-3-tutorial.readthedocs.io/>`_
1717
is available.
1818

1919
`PyGTK <http://www.pygtk.org/>`_
@@ -35,7 +35,7 @@ available for Python:
3535
Compared to PyQt, its licensing scheme is friendlier to non-open source
3636
applications.
3737

38-
`wxPython <http://www.wxpython.org>`_
38+
`wxPython <https://www.wxpython.org>`_
3939
wxPython is a cross-platform GUI toolkit for Python that is built around
4040
the popular `wxWidgets <https://www.wxwidgets.org/>`_ (formerly wxWindows)
4141
C++ toolkit. It provides a native look and feel for applications on

Doc/library/re.rst

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -708,55 +708,41 @@ form.
708708
That way, separator components are always found at the same relative
709709
indices within the result list.
710710

711-
.. note::
712-
713-
:func:`split` doesn't currently split a string on an empty pattern match.
714-
For example::
715-
716-
>>> re.split('x*', 'axbc')
717-
['a', 'bc']
711+
The pattern can match empty strings. ::
718712

719-
Even though ``'x*'`` also matches 0 'x' before 'a', between 'b' and 'c',
720-
and after 'c', currently these matches are ignored. The correct behavior
721-
(i.e. splitting on empty matches too and returning ``['', 'a', 'b', 'c',
722-
'']``) will be implemented in future versions of Python, but since this
723-
is a backward incompatible change, a :exc:`FutureWarning` will be raised
724-
in the meanwhile.
725-
726-
Patterns that can only match empty strings currently never split the
727-
string. Since this doesn't match the expected behavior, a
728-
:exc:`ValueError` will be raised starting from Python 3.5::
729-
730-
>>> re.split("^$", "foo\n\nbar\n", flags=re.M)
731-
Traceback (most recent call last):
732-
File "<stdin>", line 1, in <module>
733-
...
734-
ValueError: split() requires a non-empty pattern match.
713+
>>> re.split(r'\b', 'Words, words, words.')
714+
['', 'Words', ', ', 'words', ', ', 'words', '.']
715+
>>> re.split(r'(\W*)', '...words...')
716+
['', '...', 'w', '', 'o', '', 'r', '', 'd', '', 's', '...', '']
735717

736718
.. versionchanged:: 3.1
737719
Added the optional flags argument.
738720

739-
.. versionchanged:: 3.5
740-
Splitting on a pattern that could match an empty string now raises
741-
a warning. Patterns that can only match empty strings are now rejected.
721+
.. versionchanged:: 3.7
722+
Added support of splitting on a pattern that could match an empty string.
723+
742724

743725
.. function:: findall(pattern, string, flags=0)
744726

745727
Return all non-overlapping matches of *pattern* in *string*, as a list of
746728
strings. The *string* is scanned left-to-right, and matches are returned in
747729
the order found. If one or more groups are present in the pattern, return a
748730
list of groups; this will be a list of tuples if the pattern has more than
749-
one group. Empty matches are included in the result unless they touch the
750-
beginning of another match.
731+
one group. Empty matches are included in the result.
732+
733+
.. versionchanged:: 3.7
734+
Non-empty matches can now start just after a previous empty match.
751735

752736

753737
.. function:: finditer(pattern, string, flags=0)
754738

755739
Return an :term:`iterator` yielding :ref:`match objects <match-objects>` over
756740
all non-overlapping matches for the RE *pattern* in *string*. The *string*
757741
is scanned left-to-right, and matches are returned in the order found. Empty
758-
matches are included in the result unless they touch the beginning of another
759-
match.
742+
matches are included in the result.
743+
744+
.. versionchanged:: 3.7
745+
Non-empty matches can now start just after a previous empty match.
760746

761747

762748
.. function:: sub(pattern, repl, string, count=0, flags=0)

Doc/library/secrets.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Other functions
130130

131131
Return ``True`` if strings *a* and *b* are equal, otherwise ``False``,
132132
in such a way as to reduce the risk of
133-
`timing attacks <http://codahale.com/a-lesson-in-timing-attacks/>`_.
133+
`timing attacks <https://codahale.com/a-lesson-in-timing-attacks/>`_.
134134
See :func:`hmac.compare_digest` for additional details.
135135

136136

@@ -173,7 +173,7 @@ three digits:
173173
break
174174

175175

176-
Generate an `XKCD-style passphrase <http://xkcd.com/936/>`_:
176+
Generate an `XKCD-style passphrase <https://xkcd.com/936/>`_:
177177

178178
.. testcode::
179179

Doc/library/select.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ object.
264264
Edge and Level Trigger Polling (epoll) Objects
265265
----------------------------------------------
266266

267-
http://linux.die.net/man/4/epoll
267+
https://linux.die.net/man/4/epoll
268268

269269
*eventmask*
270270

Doc/library/sqlite3.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ This example uses the iterator form::
107107
The SQLite web page; the documentation describes the syntax and the
108108
available data types for the supported SQL dialect.
109109

110-
http://www.w3schools.com/sql/
110+
https://www.w3schools.com/sql/
111111
Tutorial, reference and examples for learning SQL syntax.
112112

113113
:pep:`249` - Database API Specification 2.0

Doc/library/ssl.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@ to speed up repeated connections from the same clients.
15901590
.. versionadded:: 3.3
15911591

15921592
.. seealso::
1593-
`SSL/TLS & Perfect Forward Secrecy <http://vincent.bernat.im/en/blog/2011-ssl-perfect-forward-secrecy.html>`_
1593+
`SSL/TLS & Perfect Forward Secrecy <https://vincent.bernat.im/en/blog/2011-ssl-perfect-forward-secrecy>`_
15941594
Vincent Bernat.
15951595

15961596
.. method:: SSLContext.wrap_socket(sock, server_side=False, \

Doc/library/threading.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,8 @@ Semaphores also support the :ref:`context management protocol <with-locks>`.
684684

685685
.. class:: Semaphore(value=1)
686686

687-
This class implements semaphore objects. A semaphore manages a counter
688-
representing the number of :meth:`release` calls minus the number of
687+
This class implements semaphore objects. A semaphore manages an atomic
688+
counter representing the number of :meth:`release` calls minus the number of
689689
:meth:`acquire` calls, plus an initial value. The :meth:`acquire` method
690690
blocks if necessary until it can return without making the counter negative.
691691
If not given, *value* defaults to 1.
@@ -701,19 +701,19 @@ Semaphores also support the :ref:`context management protocol <with-locks>`.
701701

702702
Acquire a semaphore.
703703

704-
When invoked without arguments: if the internal counter is larger than
705-
zero on entry, decrement it by one and return immediately. If it is zero
706-
on entry, block, waiting until some other thread has called
707-
:meth:`~Semaphore.release` to make it larger than zero. This is done
708-
with proper interlocking so that if multiple :meth:`acquire` calls are
709-
blocked, :meth:`~Semaphore.release` will wake exactly one of them up.
710-
The implementation may pick one at random, so the order in which
711-
blocked threads are awakened should not be relied on. Returns
712-
true (or blocks indefinitely).
704+
When invoked without arguments:
705+
706+
* If the internal counter is larger than zero on entry, decrement it by
707+
one and return true immediately.
708+
* If the internal counter is zero on entry, block until awoken by a call to
709+
:meth:`~Semaphore.release`. Once awoken (and the counter is greater
710+
than 0), decrement the counter by 1 and return true. Exactly one
711+
thread will be awoken by each call to :meth:`~Semaphore.release`. The
712+
order in which threads are awoken should not be relied on.
713713

714714
When invoked with *blocking* set to false, do not block. If a call
715-
without an argument would block, return false immediately; otherwise,
716-
do the same thing as when called without arguments, and return true.
715+
without an argument would block, return false immediately; otherwise, do
716+
the same thing as when called without arguments, and return true.
717717

718718
When invoked with a *timeout* other than ``None``, it will block for at
719719
most *timeout* seconds. If acquire does not complete successfully in

0 commit comments

Comments
 (0)