Skip to content

Commit 731f79d

Browse files
committed
Merge remote-tracking branch 'upstream/main' into special_decref
2 parents 0d6a598 + 4a66615 commit 731f79d

File tree

587 files changed

+13546
-7530
lines changed

Some content is hidden

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

587 files changed

+13546
-7530
lines changed

.azure-pipelines/windows-release.yml

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ parameters:
3434
displayName: "Signature description"
3535
type: string
3636
default: 'Built: $(Build.BuildNumber)'
37+
- name: DoARM64
38+
displayName: "Publish ARM64 build"
39+
type: boolean
40+
default: true
3741
- name: DoPGO
3842
displayName: "Run PGO"
3943
type: boolean
@@ -64,25 +68,26 @@ parameters:
6468
default: '0'
6569

6670
variables:
67-
__RealSigningCertificate: 'Python Software Foundation'
68-
${{ if ne(parameters.GitRemote, '(Other)') }}:
69-
GitRemote: ${{ parameters.GitRemote }}
70-
${{ else }}:
71-
GitRemote: ${{ parameters.GitRemote_Other }}
72-
SourceTag: ${{ parameters.SourceTag }}
73-
DoPGO: ${{ parameters.DoPGO }}
74-
${{ if ne(parameters.SigningCertificate, 'Unsigned') }}:
75-
SigningCertificate: ${{ parameters.SigningCertificate }}
76-
SigningDescription: ${{ parameters.SigningDescription }}
77-
DoLayout: ${{ parameters.DoLayout }}
78-
DoMSIX: ${{ parameters.DoMSIX }}
79-
DoNuget: ${{ parameters.DoNuget }}
80-
DoEmbed: ${{ parameters.DoEmbed }}
81-
DoMSI: ${{ parameters.DoMSI }}
82-
DoPublish: ${{ parameters.DoPublish }}
71+
__RealSigningCertificate: 'Python Software Foundation'
72+
${{ if ne(parameters.GitRemote, '(Other)') }}:
73+
GitRemote: ${{ parameters.GitRemote }}
74+
${{ else }}:
75+
GitRemote: ${{ parameters.GitRemote_Other }}
76+
SourceTag: ${{ parameters.SourceTag }}
77+
DoPGO: ${{ parameters.DoPGO }}
78+
${{ if ne(parameters.SigningCertificate, 'Unsigned') }}:
79+
SigningCertificate: ${{ parameters.SigningCertificate }}
80+
SigningDescription: ${{ parameters.SigningDescription }}
81+
DoLayout: ${{ parameters.DoLayout }}
82+
DoMSIX: ${{ parameters.DoMSIX }}
83+
DoNuget: ${{ parameters.DoNuget }}
84+
DoEmbed: ${{ parameters.DoEmbed }}
85+
DoMSI: ${{ parameters.DoMSI }}
86+
DoPublish: ${{ parameters.DoPublish }}
87+
PublishARM64: ${{ parameters.DoARM64 }}
8388
# QUEUE TIME VARIABLES
84-
# PyDotOrgUsername: ''
85-
# PyDotOrgServer: ''
89+
# PyDotOrgUsername: ''
90+
# PyDotOrgServer: ''
8691

8792
trigger: none
8893
pr: none

.azure-pipelines/windows-release/msi-steps.yml

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,20 @@ steps:
4545
artifactName: bin_amd64_d
4646
targetPath: $(Build.BinariesDirectory)\amd64
4747

48+
- task: DownloadPipelineArtifact@1
49+
displayName: 'Download artifact: bin_arm64'
50+
condition: and(succeeded(), eq(variables['PublishARM64'], 'true'))
51+
inputs:
52+
artifactName: bin_arm64
53+
targetPath: $(Build.BinariesDirectory)\arm64
54+
55+
- task: DownloadPipelineArtifact@1
56+
displayName: 'Download artifact: bin_arm64_d'
57+
condition: and(succeeded(), eq(variables['PublishARM64'], 'true'))
58+
inputs:
59+
artifactName: bin_arm64_d
60+
targetPath: $(Build.BinariesDirectory)\arm64
61+
4862
- task: DownloadPipelineArtifact@1
4963
displayName: 'Download artifact: tcltk_lib_win32'
5064
inputs:
@@ -84,32 +98,45 @@ steps:
8498
8599
- script: |
86100
%MSBUILD% Tools\msi\bundle\releaselocal.wixproj /t:Rebuild /p:RebuildAll=true
87-
%MSBUILD% Tools\msi\bundle\releaseweb.wixproj /t:Rebuild /p:RebuildAll=false
88101
displayName: 'Build win32 installer'
89102
env:
90103
Platform: x86
91104
Py_OutDir: $(Build.BinariesDirectory)
92105
PYTHON: $(Build.BinariesDirectory)\win32\python.exe
106+
PythonForBuild: $(Build.BinariesDirectory)\win32\python.exe
93107
PYTHONHOME: $(Build.SourcesDirectory)
94108
TclTkLibraryDir: $(Build.BinariesDirectory)\tcltk_lib_win32
95109
BuildForRelease: true
96110
SuppressMinGWLib: true
97111
98112
- script: |
99113
%MSBUILD% Tools\msi\bundle\releaselocal.wixproj /t:Rebuild /p:RebuildAll=true
100-
%MSBUILD% Tools\msi\bundle\releaseweb.wixproj /t:Rebuild /p:RebuildAll=false
101114
displayName: 'Build amd64 installer'
102115
env:
103116
Platform: x64
104117
Py_OutDir: $(Build.BinariesDirectory)
105118
PYTHON: $(Build.BinariesDirectory)\amd64\python.exe
119+
PythonForBuild: $(Build.BinariesDirectory)\amd64\python.exe
106120
PYTHONHOME: $(Build.SourcesDirectory)
107121
TclTkLibraryDir: $(Build.BinariesDirectory)\tcltk_lib_amd64
108122
BuildForRelease: true
109123
SuppressMinGWLib: true
110124
125+
- script: |
126+
%MSBUILD% Tools\msi\bundle\releaselocal.wixproj /t:Rebuild /p:RebuildAll=true
127+
displayName: 'Build arm64 installer'
128+
condition: and(succeeded(), eq(variables['PublishARM64'], 'true'))
129+
env:
130+
Platform: ARM64
131+
Py_OutDir: $(Build.BinariesDirectory)
132+
PYTHON: $(Build.BinariesDirectory)\win32\python.exe
133+
PythonForBuild: $(Build.BinariesDirectory)\win32\python.exe
134+
PYTHONHOME: $(Build.SourcesDirectory)
135+
BuildForRelease: true
136+
SuppressMinGWLib: true
137+
111138
- task: CopyFiles@2
112-
displayName: 'Assemble artifact: msi (1/2)'
139+
displayName: 'Assemble artifact: msi (win32)'
113140
inputs:
114141
sourceFolder: $(Build.BinariesDirectory)\win32\en-us
115142
targetFolder: $(Build.ArtifactStagingDirectory)\msi\win32
@@ -119,7 +146,7 @@ steps:
119146
*.exe
120147
121148
- task: CopyFiles@2
122-
displayName: 'Assemble artifact: msi (2/2)'
149+
displayName: 'Assemble artifact: msi (amd64)'
123150
inputs:
124151
sourceFolder: $(Build.BinariesDirectory)\amd64\en-us
125152
targetFolder: $(Build.ArtifactStagingDirectory)\msi\amd64
@@ -128,6 +155,17 @@ steps:
128155
*.cab
129156
*.exe
130157
158+
- task: CopyFiles@2
159+
displayName: 'Assemble artifact: msi (arm64)'
160+
condition: and(succeeded(), eq(variables['PublishARM64'], 'true'))
161+
inputs:
162+
sourceFolder: $(Build.BinariesDirectory)\arm64\en-us
163+
targetFolder: $(Build.ArtifactStagingDirectory)\msi\arm64
164+
contents: |
165+
*.msi
166+
*.cab
167+
*.exe
168+
131169
- task: PublishPipelineArtifact@0
132170
displayName: 'Publish MSI'
133171
inputs:

.azure-pipelines/windows-release/stage-publish-nugetorg.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ jobs:
3636

3737

3838
- powershell: 'gci pythonarm*.nupkg | %{ Write-Host "Not publishing: $($_.Name)"; gi $_ } | del'
39-
displayName: 'Prevent publishing ARM/ARM64 packages'
39+
displayName: 'Prevent publishing ARM64 packages'
4040
workingDirectory: '$(Build.BinariesDirectory)\nuget'
41-
condition: and(succeeded(), not(variables['PublishArmPackages']))
41+
condition: and(succeeded(), eq(variables['PublishARM64'], 'true'))
4242

4343
- task: NuGetCommand@2
4444
displayName: Push packages

.azure-pipelines/windows-release/stage-publish-pythonorg.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,11 @@ jobs:
7777
downloadPath: $(Build.BinariesDirectory)
7878

7979

80+
# Note that ARM64 MSIs are skipped at build when this option is specified
8081
- powershell: 'gci *embed-arm*.zip | %{ Write-Host "Not publishing: $($_.Name)"; gi $_ } | del'
81-
displayName: 'Prevent publishing ARM/ARM64 packages'
82+
displayName: 'Prevent publishing ARM64 packages'
8283
workingDirectory: '$(Build.BinariesDirectory)\embed'
83-
condition: and(succeeded(), not(variables['PublishArmPackages']))
84+
condition: and(succeeded(), eq(variables['PublishARM64'], 'true'))
8485

8586

8687
- template: ./gpg-sign.yml

.azure-pipelines/windows-release/stage-test-msi.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ jobs:
1111
strategy:
1212
matrix:
1313
win32_User:
14-
ExeMatch: 'python-[\dabrc.]+-webinstall\.exe'
14+
ExeMatch: 'python-[\dabrc.]+\.exe'
1515
Logs: $(Build.ArtifactStagingDirectory)\logs\win32_User
1616
InstallAllUsers: 0
1717
win32_Machine:
18-
ExeMatch: 'python-[\dabrc.]+-webinstall\.exe'
18+
ExeMatch: 'python-[\dabrc.]+\.exe'
1919
Logs: $(Build.ArtifactStagingDirectory)\logs\win32_Machine
2020
InstallAllUsers: 1
2121
amd64_User:
22-
ExeMatch: 'python-[\dabrc.]+-amd64-webinstall\.exe'
22+
ExeMatch: 'python-[\dabrc.]+-amd64\.exe'
2323
Logs: $(Build.ArtifactStagingDirectory)\logs\amd64_User
2424
InstallAllUsers: 0
2525
amd64_Machine:
26-
ExeMatch: 'python-[\dabrc.]+-amd64-webinstall\.exe'
26+
ExeMatch: 'python-[\dabrc.]+-amd64\.exe'
2727
Logs: $(Build.ArtifactStagingDirectory)\logs\amd64_Machine
2828
InstallAllUsers: 1
2929

.github/workflows/build.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ jobs:
100100
run: make smelly
101101
- name: Check limited ABI symbols
102102
run: make check-limited-abi
103+
- name: Check global objects
104+
run: make check-global-objects
103105

104106
build_win32:
105107
name: 'Windows (x86)'
@@ -311,4 +313,7 @@ jobs:
311313
#
312314
# Skip multiprocessing and concurrent.futures tests which are affected by
313315
# bpo-45200 bug: libasan dead lock in pthread_create().
314-
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu -x test_ctypes test_crypt test_decimal test_faulthandler test_interpreters test___all__ test_idle test_tix test_tk test_ttk_guionly test_ttk_textonly test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_spawn test_tools test_peg_generator test_concurrent_futures"
316+
#
317+
# test___all__ is skipped because importing some modules directly can trigger
318+
# known problems with ASAN (like tk or crypt).
319+
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu -x test___all__ test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_spawn test_tools test_peg_generator test_concurrent_futures"

.github/workflows/build_msi.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,11 @@ jobs:
3737
- uses: actions/checkout@v2
3838
- name: Build CPython installer
3939
run: .\Tools\msi\build.bat -x64
40+
41+
build_win_arm64:
42+
name: 'Windows (ARM64) Installer'
43+
runs-on: windows-latest
44+
steps:
45+
- uses: actions/checkout@v2
46+
- name: Build CPython installer
47+
run: .\Tools\msi\build.bat -arm64

.github/workflows/stale.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ permissions:
99

1010
jobs:
1111
stale:
12+
if: github.repository_owner == 'python'
1213

1314
runs-on: ubuntu-latest
1415

Doc/Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
PYTHON = python3
88
VENVDIR = ./venv
99
SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build
10+
SPHINXLINT = PATH=$(VENVDIR)/bin:$$PATH sphinx-lint
1011
BLURB = PATH=$(VENVDIR)/bin:$$PATH blurb
1112
PAPER =
1213
SOURCES =
1314
DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py)
1415
SPHINXERRORHANDLING = -W
16+
SERVE_PORT =
1517

1618
# Internal variables.
1719
PAPEROPT_a4 = -D latex_elements.papersize=a4paper
@@ -213,11 +215,11 @@ dist:
213215
rm dist/python-$(DISTVERSION)-docs-texinfo.tar
214216

215217
check:
216-
$(PYTHON) tools/rstlint.py -i tools -i $(VENVDIR) -i README.rst
217-
$(PYTHON) tools/rstlint.py ../Misc/NEWS.d/next/
218+
$(SPHINXLINT) -i tools -i $(VENVDIR) -i README.rst
219+
$(SPHINXLINT) ../Misc/NEWS.d/next/
218220

219221
serve:
220-
$(PYTHON) ../Tools/scripts/serve.py build/html
222+
$(PYTHON) ../Tools/scripts/serve.py build/html $(SERVE_PORT)
221223

222224
# Targets for daily automated doc build
223225
# By default, Sphinx only rebuilds pages where the page content has changed.

Doc/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Available make targets are:
9191

9292
* "pydoc-topics", which builds a Python module containing a dictionary with
9393
plain text documentation for the labels defined in
94-
`tools/pyspecific.py` -- pydoc needs these to show topic and keyword help.
94+
``tools/pyspecific.py`` -- pydoc needs these to show topic and keyword help.
9595

9696
* "suspicious", which checks the parsed markup for text that looks like
9797
malformed and thus unconverted reST.

Doc/c-api/buffer.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,13 @@ Buffer-related functions
499499
This function fails if *len* != *src->len*.
500500
501501
502+
.. c:function:: int PyObject_CopyData(Py_buffer *dest, Py_buffer *src)
503+
504+
Copy data from *src* to *dest* buffer. Can convert between C-style and
505+
or Fortran-style buffers.
506+
507+
``0`` is returned on success, ``-1`` on error.
508+
502509
.. c:function:: void PyBuffer_FillContiguousStrides(int ndims, Py_ssize_t *shape, Py_ssize_t *strides, int itemsize, char order)
503510
504511
Fill the *strides* array with byte-strides of a :term:`contiguous` (C-style if

Doc/c-api/import.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,12 @@ Importing Modules
256256
const char *name;
257257
const unsigned char *code;
258258
int size;
259+
bool is_package;
259260
};
260261
262+
.. versionchanged:: 3.11
263+
The new ``is_package`` field indicates whether the module is a package or not.
264+
This replaces setting the ``size`` field to a negative value.
261265
262266
.. c:var:: const struct _frozen* PyImport_FrozenModules
263267

Doc/c-api/type.rst

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ Type Objects
149149
``Py_TYPE(self)`` may be a *subclass* of the intended class, and subclasses
150150
are not necessarily defined in the same module as their superclass.
151151
See :c:type:`PyCMethod` to get the class that defines the method.
152+
See :c:func:`PyType_GetModuleByDef` for cases when ``PyCMethod`` cannot
153+
be used.
152154
153155
.. versionadded:: 3.9
154156
@@ -166,6 +168,21 @@ Type Objects
166168
167169
.. versionadded:: 3.9
168170
171+
.. c:function:: PyObject* PyType_GetModuleByDef(PyTypeObject *type, struct PyModuleDef *def)
172+
173+
Find the first superclass whose module was created from
174+
the given :c:type:`PyModuleDef` *def*, and return that module.
175+
176+
If no module is found, raises a :py:class:`TypeError` and returns ``NULL``.
177+
178+
This function is intended to be used together with
179+
:c:func:`PyModule_GetState()` to get module state from slot methods (such as
180+
:c:member:`~PyTypeObject.tp_init` or :c:member:`~PyNumberMethods.nb_add`)
181+
and other places where a method's defining class cannot be passed using the
182+
:c:type:`PyCMethod` calling convention.
183+
184+
.. versionadded:: 3.11
185+
169186
170187
Creating Heap-Allocated Types
171188
.............................
@@ -272,12 +289,6 @@ The following functions and structs are used to create
272289
* :c:member:`~PyTypeObject.tp_vectorcall_offset`
273290
(see :ref:`PyMemberDef <pymemberdef-offsets>`)
274291
275-
The following fields cannot be set using :c:type:`PyType_Spec` and
276-
:c:type:`PyType_Slot` under the limited API:
277-
278-
* :c:member:`~PyBufferProcs.bf_getbuffer`
279-
* :c:member:`~PyBufferProcs.bf_releasebuffer`
280-
281292
Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be
282293
problematic on some platforms.
283294
To avoid issues, use the *bases* argument of
@@ -287,6 +298,11 @@ The following functions and structs are used to create
287298
288299
Slots in :c:type:`PyBufferProcs` in may be set in the unlimited API.
289300
301+
.. versionchanged:: 3.11
302+
:c:member:`~PyBufferProcs.bf_getbuffer` and
303+
:c:member:`~PyBufferProcs.bf_releasebuffer` are now available
304+
under limited API.
305+
290306
.. c:member:: void *PyType_Slot.pfunc
291307
292308
The desired value of the slot. In most cases, this is a pointer

0 commit comments

Comments
 (0)