Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 326ce5e

Browse files
author
Anselm Kruis
committed
Merge branch main into main-slp
2 parents 05b86f7 + 5489bda commit 326ce5e

File tree

120 files changed

+2117
-1172
lines changed

Some content is hidden

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

120 files changed

+2117
-1172
lines changed

Doc/library/site.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,22 @@ not mentioned in either path configuration file.
9797
After these path manipulations, an attempt is made to import a module named
9898
:mod:`sitecustomize`, which can perform arbitrary site-specific customizations.
9999
It is typically created by a system administrator in the site-packages
100-
directory. If this import fails with an :exc:`ImportError` exception, it is
101-
silently ignored. If Python is started without output streams available, as
100+
directory. If this import fails with an :exc:`ImportError` or its subclass
101+
exception, and the exception's :attr:`name` attribute equals to ``'sitecustomize'``,
102+
it is silently ignored. If Python is started without output streams available, as
102103
with :file:`pythonw.exe` on Windows (which is used by default to start IDLE),
103-
attempted output from :mod:`sitecustomize` is ignored. Any exception other
104-
than :exc:`ImportError` causes a silent and perhaps mysterious failure of the
105-
process.
104+
attempted output from :mod:`sitecustomize` is ignored. Any other exception
105+
causes a silent and perhaps mysterious failure of the process.
106106

107107
.. index:: module: usercustomize
108108

109109
After this, an attempt is made to import a module named :mod:`usercustomize`,
110110
which can perform arbitrary user-specific customizations, if
111111
:data:`ENABLE_USER_SITE` is true. This file is intended to be created in the
112112
user site-packages directory (see below), which is part of ``sys.path`` unless
113-
disabled by :option:`-s`. An :exc:`ImportError` will be silently ignored.
113+
disabled by :option:`-s`. If this import fails with an :exc:`ImportError` or
114+
its subclass exception, and the exception's :attr:`name` attribute equals to
115+
``'usercustomize'``, it is silently ignored.
114116

115117
Note that for some non-Unix systems, ``sys.prefix`` and ``sys.exec_prefix`` are
116118
empty, and the path manipulations are skipped; however the import of

Doc/library/tarfile.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,8 @@ be finalized; only the internally used file object will be closed. See the
451451
(directory, fifo, symbolic link, etc.). If given, *arcname* specifies an
452452
alternative name for the file in the archive. Directories are added
453453
recursively by default. This can be avoided by setting *recursive* to
454-
:const:`False`. If *filter* is given, it
454+
:const:`False`. Recursion adds entries in sorted order.
455+
If *filter* is given, it
455456
should be a function that takes a :class:`TarInfo` object argument and
456457
returns the changed :class:`TarInfo` object. If it instead returns
457458
:const:`None` the :class:`TarInfo` object will be excluded from the
@@ -460,6 +461,9 @@ be finalized; only the internally used file object will be closed. See the
460461
.. versionchanged:: 3.2
461462
Added the *filter* parameter.
462463

464+
.. versionchanged:: 3.7
465+
Recursion adds entries in sorted order.
466+
463467

464468
.. method:: TarFile.addfile(tarinfo, fileobj=None)
465469

Doc/library/zipfile.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ The :class:`PyZipFile` constructor takes the same parameters as the
491491
:file:`\*.pyc` are added at the top level. If the directory is a
492492
package directory, then all :file:`\*.pyc` are added under the package
493493
name as a file path, and if any subdirectories are package directories,
494-
all of these are added recursively.
494+
all of these are added recursively in sorted order.
495495

496496
*basename* is intended for internal use only.
497497

@@ -524,6 +524,9 @@ The :class:`PyZipFile` constructor takes the same parameters as the
524524
.. versionchanged:: 3.6.2
525525
The *pathname* parameter accepts a :term:`path-like object`.
526526

527+
.. versionchanged:: 3.7
528+
Recursion sorts directory entries.
529+
527530

528531
.. _zipinfo-objects:
529532

Doc/reference/lexical_analysis.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ Some examples of formatted string literals::
676676
>>> f"result: {value:{width}.{precision}}" # nested fields
677677
'result: 12.35'
678678
>>> today = datetime(year=2017, month=1, day=27)
679-
>>> f"{today:%b %d, %Y}" # using date format specifier
679+
>>> f"{today:%B %d, %Y}" # using date format specifier
680680
'January 27, 2017'
681681
>>> number = 1024
682682
>>> f"{number:#0x}" # using integer format specifier

Doc/tutorial/interpreter.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ Using the Python Interpreter
1010
Invoking the Interpreter
1111
========================
1212

13-
The Python interpreter is usually installed as :file:`/usr/local/bin/python3.7`
13+
The Python interpreter is usually installed as :file:`/usr/local/bin/python3.8`
1414
on those machines where it is available; putting :file:`/usr/local/bin` in your
1515
Unix shell's search path makes it possible to start it by typing the command:
1616

1717
.. code-block:: text
1818
19-
python3.7
19+
python3.8
2020
2121
to the shell. [#]_ Since the choice of the directory where the interpreter lives
2222
is an installation option, other places are possible; check with your local
@@ -98,8 +98,8 @@ before printing the first prompt:
9898

9999
.. code-block:: shell-session
100100
101-
$ python3.7
102-
Python 3.7 (default, Sep 16 2015, 09:25:04)
101+
$ python3.8
102+
Python 3.8 (default, Sep 16 2015, 09:25:04)
103103
[GCC 4.8.2] on linux
104104
Type "help", "copyright", "credits" or "license" for more information.
105105
>>>

Doc/tutorial/stdlib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ operating system::
1515

1616
>>> import os
1717
>>> os.getcwd() # Return the current working directory
18-
'C:\\Python37'
18+
'C:\\Python38'
1919
>>> os.chdir('/server/accesslogs') # Change current working directory
2020
>>> os.system('mkdir today') # Run the command mkdir in the system shell
2121
0

Doc/tutorial/stdlib2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ applications include caching objects that are expensive to create::
278278
Traceback (most recent call last):
279279
File "<stdin>", line 1, in <module>
280280
d['primary'] # entry was automatically removed
281-
File "C:/python37/lib/weakref.py", line 46, in __getitem__
281+
File "C:/python38/lib/weakref.py", line 46, in __getitem__
282282
o = self.data[key]()
283283
KeyError: 'primary'
284284

Include/patchlevel.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
/* Version parsed out into numeric values */
1818
/*--start constants--*/
1919
#define PY_MAJOR_VERSION 3
20-
#define PY_MINOR_VERSION 7
20+
#define PY_MINOR_VERSION 8
2121
#define PY_MICRO_VERSION 0
2222
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA
23-
#define PY_RELEASE_SERIAL 4
23+
#define PY_RELEASE_SERIAL 0
2424

2525
/* Version as a string */
26-
#define PY_VERSION "3.7.0a4+"
26+
#define PY_VERSION "3.8.0a0"
2727
/*--end constants--*/
2828

2929
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.

Lib/collections/__init__.py

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,7 @@
1717
__all__ = ['deque', 'defaultdict', 'namedtuple', 'UserDict', 'UserList',
1818
'UserString', 'Counter', 'OrderedDict', 'ChainMap']
1919

20-
# For backwards compatibility, continue to make the collections ABCs
21-
# through Python 3.6 available through the collections module.
22-
# Note, no new collections ABCs were added in Python 3.7
2320
import _collections_abc
24-
from _collections_abc import (AsyncGenerator, AsyncIterable, AsyncIterator,
25-
Awaitable, ByteString, Callable, Collection, Container, Coroutine,
26-
Generator, Hashable, ItemsView, Iterable, Iterator, KeysView, Mapping,
27-
MappingView, MutableMapping, MutableSequence, MutableSet, Reversible,
28-
Sequence, Set, Sized, ValuesView)
29-
3021
from operator import itemgetter as _itemgetter, eq as _eq
3122
from keyword import iskeyword as _iskeyword
3223
import sys as _sys
@@ -40,30 +31,45 @@
4031
except ImportError:
4132
pass
4233
else:
43-
MutableSequence.register(deque)
34+
_collections_abc.MutableSequence.register(deque)
4435

4536
try:
4637
from _collections import defaultdict
4738
except ImportError:
4839
pass
4940

5041

42+
def __getattr__(name):
43+
# For backwards compatibility, continue to make the collections ABCs
44+
# through Python 3.6 available through the collections module.
45+
# Note, no new collections ABCs were added in Python 3.7
46+
if name in _collections_abc.__all__:
47+
obj = getattr(_collections_abc, name)
48+
import warnings
49+
warnings.warn("Using or importing the ABCs from 'collections' instead "
50+
"of from 'collections.abc' is deprecated, "
51+
"and in 3.8 it will stop working",
52+
DeprecationWarning, stacklevel=2)
53+
globals()[name] = obj
54+
return obj
55+
raise AttributeError(f'module {__name__!r} has no attribute {name!r}')
56+
5157
################################################################################
5258
### OrderedDict
5359
################################################################################
5460

55-
class _OrderedDictKeysView(KeysView):
61+
class _OrderedDictKeysView(_collections_abc.KeysView):
5662

5763
def __reversed__(self):
5864
yield from reversed(self._mapping)
5965

60-
class _OrderedDictItemsView(ItemsView):
66+
class _OrderedDictItemsView(_collections_abc.ItemsView):
6167

6268
def __reversed__(self):
6369
for key in reversed(self._mapping):
6470
yield (key, self._mapping[key])
6571

66-
class _OrderedDictValuesView(ValuesView):
72+
class _OrderedDictValuesView(_collections_abc.ValuesView):
6773

6874
def __reversed__(self):
6975
for key in reversed(self._mapping):
@@ -215,7 +221,7 @@ def __sizeof__(self):
215221
size += sizeof(self.__root) * n # proxy objects
216222
return size
217223

218-
update = __update = MutableMapping.update
224+
update = __update = _collections_abc.MutableMapping.update
219225

220226
def keys(self):
221227
"D.keys() -> a set-like object providing a view on D's keys"
@@ -229,7 +235,7 @@ def values(self):
229235
"D.values() -> an object providing a view on D's values"
230236
return _OrderedDictValuesView(self)
231237

232-
__ne__ = MutableMapping.__ne__
238+
__ne__ = _collections_abc.MutableMapping.__ne__
233239

234240
__marker = object()
235241

@@ -636,7 +642,7 @@ def update(*args, **kwds):
636642
raise TypeError('expected at most 1 arguments, got %d' % len(args))
637643
iterable = args[0] if args else None
638644
if iterable is not None:
639-
if isinstance(iterable, Mapping):
645+
if isinstance(iterable, _collections_abc.Mapping):
640646
if self:
641647
self_get = self.get
642648
for elem, count in iterable.items():
@@ -673,7 +679,7 @@ def subtract(*args, **kwds):
673679
iterable = args[0] if args else None
674680
if iterable is not None:
675681
self_get = self.get
676-
if isinstance(iterable, Mapping):
682+
if isinstance(iterable, _collections_abc.Mapping):
677683
for elem, count in iterable.items():
678684
self[elem] = self_get(elem, 0) - count
679685
else:
@@ -875,7 +881,7 @@ def __iand__(self, other):
875881
### ChainMap
876882
########################################################################
877883

878-
class ChainMap(MutableMapping):
884+
class ChainMap(_collections_abc.MutableMapping):
879885
''' A ChainMap groups multiple dicts (or other mappings) together
880886
to create a single, updateable view.
881887
@@ -983,7 +989,7 @@ def clear(self):
983989
### UserDict
984990
################################################################################
985991

986-
class UserDict(MutableMapping):
992+
class UserDict(_collections_abc.MutableMapping):
987993

988994
# Start by filling-out the abstract methods
989995
def __init__(*args, **kwargs):
@@ -1050,7 +1056,7 @@ def fromkeys(cls, iterable, value=None):
10501056
### UserList
10511057
################################################################################
10521058

1053-
class UserList(MutableSequence):
1059+
class UserList(_collections_abc.MutableSequence):
10541060
"""A more or less complete user-defined wrapper around list objects."""
10551061
def __init__(self, initlist=None):
10561062
self.data = []
@@ -1123,7 +1129,7 @@ def extend(self, other):
11231129
### UserString
11241130
################################################################################
11251131

1126-
class UserString(Sequence):
1132+
class UserString(_collections_abc.Sequence):
11271133
def __init__(self, seq):
11281134
if isinstance(seq, str):
11291135
self.data = seq

0 commit comments

Comments
 (0)