Skip to content

Commit 175b0d3

Browse files
Merge branch 'main' into range-iter
2 parents 7a42474 + 2826426 commit 175b0d3

File tree

191 files changed

+12469
-10267
lines changed

Some content is hidden

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

191 files changed

+12469
-10267
lines changed

.azure-pipelines/ci.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
variables:
22
coverage: false
33

4-
trigger: ['main', '3.9', '3.8', '3.7']
4+
trigger: ['main', '3.10', '3.9', '3.8', '3.7']
55

66
jobs:
77
- job: Prebuild
88
displayName: Pre-build checks
99

1010
pool:
11-
vmImage: ubuntu-18.04
11+
vmImage: ubuntu-20.04
1212

1313
steps:
1414
- template: ./prebuild-checks.yml
@@ -20,7 +20,7 @@ jobs:
2020
condition: and(succeeded(), eq(dependencies.Prebuild.outputs['docs.run'], 'true'))
2121

2222
pool:
23-
vmImage: ubuntu-18.04
23+
vmImage: ubuntu-20.04
2424

2525
steps:
2626
- template: ./docs-steps.yml
@@ -40,7 +40,7 @@ jobs:
4040
testRunPlatform: macos
4141

4242
pool:
43-
vmImage: macos-10.14
43+
vmImage: macos-10.15
4444

4545
steps:
4646
- template: ./macos-steps.yml
@@ -52,12 +52,12 @@ jobs:
5252
condition: and(succeeded(), eq(dependencies.Prebuild.outputs['tests.run'], 'true'))
5353

5454
pool:
55-
vmImage: ubuntu-18.04
55+
vmImage: ubuntu-20.04
5656

5757
variables:
5858
testRunTitle: '$(build.sourceBranchName)-linux'
5959
testRunPlatform: linux
60-
openssl_version: 1.1.1k
60+
openssl_version: 1.1.1l
6161

6262
steps:
6363
- template: ./posix-steps.yml
@@ -78,12 +78,12 @@ jobs:
7878
)
7979
8080
pool:
81-
vmImage: ubuntu-18.04
81+
vmImage: ubuntu-20.04
8282

8383
variables:
8484
testRunTitle: '$(Build.SourceBranchName)-linux-coverage'
8585
testRunPlatform: linux-coverage
86-
openssl_version: 1.1.1k
86+
openssl_version: 1.1.1l
8787

8888
steps:
8989
- template: ./posix-steps.yml

.azure-pipelines/pr.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
variables:
22
coverage: false
33

4-
pr: ['main', '3.9', '3.8', '3.7']
4+
pr: ['main', '3.10', '3.9', '3.8', '3.7']
55

66
jobs:
77
- job: Prebuild
88
displayName: Pre-build checks
99

1010
pool:
11-
vmImage: ubuntu-18.04
11+
vmImage: ubuntu-20.04
1212

1313
steps:
1414
- template: ./prebuild-checks.yml
@@ -20,7 +20,7 @@ jobs:
2020
condition: and(succeeded(), eq(dependencies.Prebuild.outputs['docs.run'], 'true'))
2121

2222
pool:
23-
vmImage: ubuntu-18.04
23+
vmImage: ubuntu-20.04
2424

2525
steps:
2626
- template: ./docs-steps.yml
@@ -38,7 +38,7 @@ jobs:
3838
testRunPlatform: macos
3939

4040
pool:
41-
vmImage: macos-10.14
41+
vmImage: macos-10.15
4242

4343
steps:
4444
- template: ./macos-steps.yml
@@ -52,12 +52,12 @@ jobs:
5252
condition: and(succeeded(), eq(dependencies.Prebuild.outputs['tests.run'], 'true'))
5353

5454
pool:
55-
vmImage: ubuntu-18.04
55+
vmImage: ubuntu-20.04
5656

5757
variables:
5858
testRunTitle: '$(system.pullRequest.TargetBranch)-linux'
5959
testRunPlatform: linux
60-
openssl_version: 1.1.1k
60+
openssl_version: 1.1.1l
6161

6262
steps:
6363
- template: ./posix-steps.yml
@@ -78,12 +78,12 @@ jobs:
7878
)
7979
8080
pool:
81-
vmImage: ubuntu-18.04
81+
vmImage: ubuntu-20.04
8282

8383
variables:
8484
testRunTitle: '$(Build.SourceBranchName)-linux-coverage'
8585
testRunPlatform: linux-coverage
86-
openssl_version: 1.1.1k
86+
openssl_version: 1.1.1l
8787

8888
steps:
8989
- template: ./posix-steps.yml

.gitattributes

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ Modules/clinic/*.h linguist-generated=true
4646
Objects/clinic/*.h linguist-generated=true
4747
PC/clinic/*.h linguist-generated=true
4848
Python/clinic/*.h linguist-generated=true
49-
Python/importlib.h linguist-generated=true
50-
Python/importlib_external.h linguist-generated=true
49+
Python/frozen_modules/*.h linguist-generated=true
5150
Include/internal/pycore_ast.h linguist-generated=true
5251
Python/Python-ast.c linguist-generated=true
5352
Include/opcode.h linguist-generated=true

.github/workflows/build.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ jobs:
7171
make regen-stdlib-module-names
7272
- name: Check for changes
7373
run: |
74+
git add -u
7475
changes=$(git status --porcelain)
7576
# Check for changes in regenerated files
7677
if ! test -z "$changes"
@@ -83,6 +84,8 @@ jobs:
8384
run: make smelly
8485
- name: Check limited ABI symbols
8586
run: make check-limited-abi
87+
- name: Check Autoconf version 2.69
88+
run: grep "Generated by GNU Autoconf 2.69" configure
8689

8790
build_win32:
8891
name: 'Windows (x86)'
@@ -138,7 +141,7 @@ jobs:
138141
needs: check_source
139142
if: needs.check_source.outputs.run_tests == 'true'
140143
env:
141-
OPENSSL_VER: 1.1.1k
144+
OPENSSL_VER: 1.1.1l
142145
PYTHONSTRICTEXTENSIONBUILD: 1
143146
steps:
144147
- uses: actions/checkout@v2
@@ -182,7 +185,7 @@ jobs:
182185
strategy:
183186
fail-fast: false
184187
matrix:
185-
openssl_ver: [1.1.1k, 3.0.0-beta1]
188+
openssl_ver: [1.1.1l, 3.0.0-beta1]
186189
env:
187190
OPENSSL_VER: ${{ matrix.openssl_ver }}
188191
MULTISSL_DIR: ${{ github.workspace }}/multissl
@@ -229,7 +232,7 @@ jobs:
229232
needs: check_source
230233
if: needs.check_source.outputs.run_tests == 'true'
231234
env:
232-
OPENSSL_VER: 1.1.1k
235+
OPENSSL_VER: 1.1.1l
233236
PYTHONSTRICTEXTENSIONBUILD: 1
234237
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
235238
steps:

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Modules/Setup.config
6868
Modules/Setup.local
6969
Modules/config.c
7070
Modules/ld_so_aix
71-
Programs/_freeze_importlib
71+
Programs/_freeze_module
7272
Programs/_testembed
7373
PC/python_nt*.h
7474
PC/pythonnt_rc*.h

Doc/c-api/init.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.
110110
Suppress error messages when calculating the module search path in
111111
:c:func:`Py_GetPath`.
112112

113-
Private flag used by ``_freeze_importlib`` and ``frozenmain`` programs.
113+
Private flag used by ``_freeze_module`` and ``frozenmain`` programs.
114114

115115
.. c:var:: int Py_HashRandomizationFlag
116116

Doc/c-api/intro.rst

+56-43
Original file line numberDiff line numberDiff line change
@@ -105,45 +105,63 @@ defined closer to where they are useful (e.g. :c:macro:`Py_RETURN_NONE`).
105105
Others of a more general utility are defined here. This is not necessarily a
106106
complete listing.
107107

108-
.. c:macro:: Py_UNREACHABLE()
108+
.. c:macro:: Py_ABS(x)
109109
110-
Use this when you have a code path that cannot be reached by design.
111-
For example, in the ``default:`` clause in a ``switch`` statement for which
112-
all possible values are covered in ``case`` statements. Use this in places
113-
where you might be tempted to put an ``assert(0)`` or ``abort()`` call.
110+
Return the absolute value of ``x``.
114111

115-
In release mode, the macro helps the compiler to optimize the code, and
116-
avoids a warning about unreachable code. For example, the macro is
117-
implemented with ``__builtin_unreachable()`` on GCC in release mode.
112+
.. versionadded:: 3.3
118113

119-
A use for ``Py_UNREACHABLE()`` is following a call a function that
120-
never returns but that is not declared :c:macro:`_Py_NO_RETURN`.
114+
.. c:macro:: Py_CHARMASK(c)
121115
122-
If a code path is very unlikely code but can be reached under exceptional
123-
case, this macro must not be used. For example, under low memory condition
124-
or if a system call returns a value out of the expected range. In this
125-
case, it's better to report the error to the caller. If the error cannot
126-
be reported to caller, :c:func:`Py_FatalError` can be used.
116+
Argument must be a character or an integer in the range [-128, 127] or [0,
117+
255]. This macro returns ``c`` cast to an ``unsigned char``.
127118

128-
.. versionadded:: 3.7
119+
.. c:macro:: Py_DEPRECATED(version)
129120
130-
.. c:macro:: Py_ABS(x)
121+
Use this for deprecated declarations. The macro must be placed before the
122+
symbol name.
131123

132-
Return the absolute value of ``x``.
124+
Example::
125+
126+
Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);
127+
128+
.. versionchanged:: 3.8
129+
MSVC support was added.
130+
131+
.. c:macro:: Py_GETENV(s)
132+
133+
Like ``getenv(s)``, but returns ``NULL`` if :option:`-E` was passed on the
134+
command line (i.e. if ``Py_IgnoreEnvironmentFlag`` is set).
135+
136+
.. c:macro:: Py_MAX(x, y)
137+
138+
Return the maximum value between ``x`` and ``y``.
133139

134140
.. versionadded:: 3.3
135141

142+
.. c:macro:: Py_MEMBER_SIZE(type, member)
143+
144+
Return the size of a structure (``type``) ``member`` in bytes.
145+
146+
.. versionadded:: 3.6
147+
136148
.. c:macro:: Py_MIN(x, y)
137149
138150
Return the minimum value between ``x`` and ``y``.
139151

140152
.. versionadded:: 3.3
141153

142-
.. c:macro:: Py_MAX(x, y)
154+
.. c:macro:: Py_NO_INLINE
143155
144-
Return the maximum value between ``x`` and ``y``.
156+
Disable inlining on a function. For example, it reduces the C stack
157+
consumption: useful on LTO+PGO builds which heavily inline code (see
158+
:issue:`33720`).
145159

146-
.. versionadded:: 3.3
160+
Usage::
161+
162+
Py_NO_INLINE static int random(void) { return 4; }
163+
164+
.. versionadded:: 3.11
147165

148166
.. c:macro:: Py_STRINGIFY(x)
149167
@@ -152,21 +170,27 @@ complete listing.
152170

153171
.. versionadded:: 3.4
154172

155-
.. c:macro:: Py_MEMBER_SIZE(type, member)
156-
157-
Return the size of a structure (``type``) ``member`` in bytes.
173+
.. c:macro:: Py_UNREACHABLE()
158174
159-
.. versionadded:: 3.6
175+
Use this when you have a code path that cannot be reached by design.
176+
For example, in the ``default:`` clause in a ``switch`` statement for which
177+
all possible values are covered in ``case`` statements. Use this in places
178+
where you might be tempted to put an ``assert(0)`` or ``abort()`` call.
160179

161-
.. c:macro:: Py_CHARMASK(c)
180+
In release mode, the macro helps the compiler to optimize the code, and
181+
avoids a warning about unreachable code. For example, the macro is
182+
implemented with ``__builtin_unreachable()`` on GCC in release mode.
162183

163-
Argument must be a character or an integer in the range [-128, 127] or [0,
164-
255]. This macro returns ``c`` cast to an ``unsigned char``.
184+
A use for ``Py_UNREACHABLE()`` is following a call a function that
185+
never returns but that is not declared :c:macro:`_Py_NO_RETURN`.
165186

166-
.. c:macro:: Py_GETENV(s)
187+
If a code path is very unlikely code but can be reached under exceptional
188+
case, this macro must not be used. For example, under low memory condition
189+
or if a system call returns a value out of the expected range. In this
190+
case, it's better to report the error to the caller. If the error cannot
191+
be reported to caller, :c:func:`Py_FatalError` can be used.
167192

168-
Like ``getenv(s)``, but returns ``NULL`` if :option:`-E` was passed on the
169-
command line (i.e. if ``Py_IgnoreEnvironmentFlag`` is set).
193+
.. versionadded:: 3.7
170194

171195
.. c:macro:: Py_UNUSED(arg)
172196
@@ -175,18 +199,6 @@ complete listing.
175199

176200
.. versionadded:: 3.4
177201

178-
.. c:macro:: Py_DEPRECATED(version)
179-
180-
Use this for deprecated declarations. The macro must be placed before the
181-
symbol name.
182-
183-
Example::
184-
185-
Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);
186-
187-
.. versionchanged:: 3.8
188-
MSVC support was added.
189-
190202
.. c:macro:: PyDoc_STRVAR(name, str)
191203
192204
Creates a variable with name ``name`` that can be used in docstrings.
@@ -221,6 +233,7 @@ complete listing.
221233
{NULL, NULL}
222234
};
223235

236+
224237
.. _api-objects:
225238

226239
Objects, Types and Reference Counts

Doc/includes/sqlite3/complete_statement.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
if buffer.lstrip().upper().startswith("SELECT"):
2525
print(cur.fetchall())
2626
except sqlite3.Error as e:
27-
print("An error occurred:", e.args[0])
27+
err_msg = str(e)
28+
err_code = e.sqlite_errorcode
29+
err_name = e.sqlite_errorname
30+
print(f"{err_name} ({err_code}): {err_msg}")
2831
buffer = ""
2932

3033
con.close()

Doc/library/2to3.rst

+9-6
Original file line numberDiff line numberDiff line change
@@ -464,12 +464,15 @@ and off individually. They are described here in more detail.
464464

465465
--------------
466466

467-
.. deprecated:: 3.10
468-
Python 3.9 will switch to a PEG parser (see :pep:`617`), and Python 3.10 may
469-
include new language syntax that is not parsable by lib2to3's LL(1) parser.
470-
The ``lib2to3`` module may be removed from the standard library in a future
471-
Python version. Consider third-party alternatives such as `LibCST`_ or
472-
`parso`_.
467+
.. deprecated-removed:: 3.11 3.13
468+
Python 3.9 switched to a PEG parser (see :pep:`617`) while lib2to3 is
469+
using a less flexible LL(1) parser. Python 3.10 includes new language
470+
syntax that is not parsable by lib2to3's LL(1) parser (see :pep:`634`).
471+
The ``lib2to3`` module was marked pending for deprecation in Python 3.9
472+
(raising :exc:`PendingDeprecationWarning` on import) and fully deprecated
473+
in Python 3.11 (raising :exc:`DeprecationWarning`).
474+
It will be removed from the standard library in Python 3.13.
475+
Consider third-party alternatives such as `LibCST`_ or `parso`_.
473476

474477
.. note::
475478

0 commit comments

Comments
 (0)