Skip to content

Commit 9045fa4

Browse files
author
Erlend E. Aasland
committed
Merge branch 'main' into sqlite-cleanup-init
2 parents bbf2083 + b567b9d commit 9045fa4

File tree

374 files changed

+14536
-7735
lines changed

Some content is hidden

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

374 files changed

+14536
-7735
lines changed

.azure-pipelines/find-tools.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Locate a set of the tools used for builds
2+
3+
steps:
4+
- template: windows-release/find-sdk.yml
5+
parameters:
6+
toolname: 'signtool.exe'
7+
8+
- powershell: |
9+
$vcvarsall = (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
10+
-prerelease `
11+
-latest `
12+
-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
13+
-find VC\Auxiliary\Build\vcvarsall.bat)
14+
Write-Host "Found vcvarsall at $vcvarsall"
15+
Write-Host "##vso[task.setVariable variable=vcvarsall]$vcvarsall"
16+
displayName: 'Find vcvarsall.bat'
17+
18+
- powershell: |
19+
$msbuild = (& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
20+
-prerelease `
21+
-latest `
22+
-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
23+
-find MSBuild\Current\Bin\msbuild.exe)
24+
Write-Host "Found MSBuild at $msbuild"
25+
Write-Host "##vso[task.setVariable variable=msbuild]$msbuild"
26+
displayName: 'Find MSBuild'

.azure-pipelines/libffi-build.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: $(SourceTag)_$(Date:yyyyMMdd)$(Rev:.rr)
2+
3+
variables:
4+
IntDir: '$(Build.BinariesDirectory)'
5+
OutDir: '$(Build.ArtifactStagingDirectory)'
6+
7+
# MUST BE SET AT QUEUE TIME
8+
# SigningCertificate: 'Python Software Foundation'
9+
# SourcesRepo: 'https://github.com/python/cpython-source-deps'
10+
# SourceTag: 'libffi-3.4.2'
11+
12+
jobs:
13+
- job: Build_LibFFI
14+
displayName: LibFFI
15+
pool:
16+
vmImage: windows-latest
17+
18+
workspace:
19+
clean: all
20+
21+
steps:
22+
- checkout: none
23+
24+
- template: ./find-tools.yml
25+
26+
- powershell: |
27+
mkdir -Force "$(IntDir)\script"
28+
iwr "https://github.com/python/cpython/raw/main/PCbuild/prepare_libffi.bat" `
29+
-outfile "$(IntDir)\script\prepare_libffi.bat"
30+
displayName: 'Download build script'
31+
32+
- powershell: |
33+
git clone $(SourcesRepo) -b $(SourceTag) --depth 1 -c core.autocrlf=false -c core.eol=lf .
34+
displayName: 'Check out LibFFI sources'
35+
36+
- script: 'prepare_libffi.bat --install-cygwin'
37+
workingDirectory: '$(IntDir)\script'
38+
displayName: 'Install Cygwin and build'
39+
env:
40+
VCVARSALL: '$(vcvarsall)'
41+
LIBFFI_SOURCE: '$(Build.SourcesDirectory)'
42+
LIBFFI_OUT: '$(OutDir)'
43+
44+
- powershell: |
45+
if ((gci *\*.dll).Count -lt 4) {
46+
Write-Error "Did not generate enough DLL files"
47+
}
48+
if ((gci *\Include\ffi.h).Count -lt 4) {
49+
Write-Error "Did not generate enough include files"
50+
}
51+
failOnStderr: true
52+
workingDirectory: '$(OutDir)'
53+
displayName: 'Verify files were created'
54+
55+
- publish: '$(OutDir)'
56+
artifact: 'unsigned'
57+
displayName: 'Publish unsigned build'
58+
59+
- job: Sign_LibFFI
60+
displayName: Sign LibFFI
61+
dependsOn: Build_LibFFI
62+
pool:
63+
name: 'Windows Release'
64+
65+
workspace:
66+
clean: all
67+
68+
steps:
69+
- checkout: none
70+
- download: current
71+
artifact: unsigned
72+
73+
- template: ./find-tools.yml
74+
75+
- powershell: |
76+
signtool sign /q /a `
77+
/n "Python Software Foundation" `
78+
/fd sha256 `
79+
/tr http://timestamp.digicert.com/ /td sha256 `
80+
/d "LibFFI for Python" `
81+
(gci "$(Pipeline.Workspace)\unsigned\*.dll" -r)
82+
displayName: 'Sign files'
83+
84+
- publish: '$(Pipeline.Workspace)\unsigned'
85+
artifact: 'libffi'
86+
displayName: 'Publish libffi'

.azure-pipelines/openssl-build.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: $(SourceTag)_$(Date:yyyyMMdd)$(Rev:.rr)
2+
3+
variables:
4+
IntDir: '$(Build.BinariesDirectory)'
5+
OutDir: '$(Build.ArtifactStagingDirectory)'
6+
7+
# MUST BE SET AT QUEUE TIME
8+
# SigningCertificate: 'Python Software Foundation'
9+
# SourcesRepo: 'https://github.com/python/cpython-source-deps'
10+
# SourceTag: 'openssl-1.1.1k'
11+
12+
jobs:
13+
- job: Build_SSL
14+
displayName: OpenSSL
15+
pool:
16+
name: 'Windows Release'
17+
#vmImage: windows-latest
18+
19+
strategy:
20+
matrix:
21+
win32:
22+
Platform: 'win32'
23+
VCPlatform: 'amd64_x86'
24+
OpenSSLPlatform: 'VC-WIN32 no-asm'
25+
amd64:
26+
Platform: 'amd64'
27+
VCPlatform: 'amd64'
28+
OpenSSLPlatform: 'VC-WIN64A-masm'
29+
arm32:
30+
Platform: 'arm32'
31+
VCPlatform: 'amd64_arm'
32+
OpenSSLPlatform: 'VC-WIN32-ARM'
33+
arm64:
34+
Platform: 'arm64'
35+
VCPlatform: 'amd64_arm64'
36+
OpenSSLPlatform: 'VC-WIN64-ARM'
37+
38+
workspace:
39+
clean: all
40+
41+
steps:
42+
- checkout: none
43+
44+
- template: ./find-tools.yml
45+
46+
- powershell: |
47+
git clone $(SourcesRepo) -b $(SourceTag) --depth 1 .
48+
displayName: 'Check out OpenSSL sources'
49+
50+
- powershell: |
51+
$f = gi ms\uplink.c
52+
$c1 = gc $f
53+
$c2 = $c1 -replace '\(\(h = GetModuleHandle\(NULL\)\) == NULL\)', '((h = GetModuleHandleA("_ssl.pyd")) == NULL) if ((h = GetModuleHandleA("_ssl_d.pyd")) == NULL) if ((h = GetModuleHandle(NULL)) == NULL /*patched*/)'
54+
if ($c2 -ne $c1) {
55+
$c2 | Out-File $f -Encoding ASCII
56+
} else {
57+
Write-Host '##warning Failed to patch uplink.c'
58+
}
59+
displayName: 'Apply uplink.c patch'
60+
61+
- script: |
62+
call "$(vcvarsall)" $(VCPlatform)
63+
perl "$(Build.SourcesDirectory)\Configure" $(OpenSSLPlatform)
64+
nmake
65+
workingDirectory: '$(IntDir)'
66+
displayName: 'Build OpenSSL'
67+
68+
- script: |
69+
call "$(vcvarsall)" $(VCPlatform)
70+
signtool sign /q /a /n "$(SigningCertificate)" /fd sha256 /tr http://timestamp.digicert.com/ /td sha256 /d "OpenSSL for Python" *.dll
71+
workingDirectory: '$(IntDir)'
72+
displayName: 'Sign OpenSSL Build'
73+
condition: and(succeeded(), variables['SigningCertificate'])
74+
75+
- task: CopyFiles@2
76+
displayName: 'Copy built libraries for upload'
77+
inputs:
78+
SourceFolder: '$(IntDir)'
79+
Contents: |
80+
lib*.dll
81+
lib*.pdb
82+
lib*.lib
83+
include\openssl\*.h
84+
TargetFolder: '$(OutDir)'
85+
86+
- task: CopyFiles@2
87+
displayName: 'Copy header files for upload'
88+
inputs:
89+
SourceFolder: '$(Build.SourcesDirectory)'
90+
Contents: |
91+
include\openssl\*
92+
TargetFolder: '$(OutDir)'
93+
94+
- task: CopyFiles@2
95+
displayName: 'Copy applink files for upload'
96+
inputs:
97+
SourceFolder: '$(Build.SourcesDirectory)\ms'
98+
Contents: applink.c
99+
TargetFolder: '$(OutDir)\include'
100+
101+
- task: CopyFiles@2
102+
displayName: 'Copy LICENSE for upload'
103+
inputs:
104+
SourceFolder: '$(Build.SourcesDirectory)'
105+
Contents: LICENSE
106+
TargetFolder: '$(OutDir)'
107+
108+
- publish: '$(OutDir)'
109+
artifact: '$(Platform)'
110+
displayName: 'Publishing $(Platform)'

.azure-pipelines/tcltk-build.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: tcl$(TkSourceTag)_$(Date:yyyyMMdd)$(Rev:.rr)
2+
3+
variables:
4+
IntDir: '$(Build.BinariesDirectory)\obj'
5+
ExternalsDir: '$(Build.BinariesDirectory)\externals'
6+
OutDir: '$(Build.ArtifactStagingDirectory)'
7+
Configuration: 'Release'
8+
9+
# MUST BE SET AT QUEUE TIME
10+
# SigningCertificate: 'Python Software Foundation'
11+
# SourcesRepo: 'https://github.com/python/cpython-source-deps'
12+
# TclSourceTag: 'tcl-core-8.6.12.0'
13+
# TkSourceTag: 'tk-8.6.12.0'
14+
# TixSourceTag: 'tix-8.4.3.6'
15+
16+
jobs:
17+
- job: Build_TclTk
18+
displayName: 'Tcl/Tk'
19+
pool:
20+
name: 'Windows Release'
21+
#vmImage: windows-latest
22+
23+
workspace:
24+
clean: all
25+
26+
steps:
27+
- template: ./find-tools.yml
28+
29+
- powershell: |
30+
git clone $(SourcesRepo) -b $(TclSourceTag) --depth 1 "$(ExternalsDir)\$(TclSourceTag)"
31+
displayName: 'Check out Tcl sources'
32+
33+
- powershell: |
34+
git clone $(SourcesRepo) -b $(TkSourceTag) --depth 1 "$(ExternalsDir)\$(TkSourceTag)"
35+
displayName: 'Check out Tk sources'
36+
37+
- powershell: |
38+
git clone $(SourcesRepo) -b $(TixSourceTag) --depth 1 "$(ExternalsDir)\$(TixSourceTag)"
39+
displayName: 'Check out Tix sources'
40+
41+
# This msbuild.rsp file will be used by the build to forcibly override these variables
42+
- powershell: |
43+
del -Force -EA 0 msbuild.rsp
44+
"/p:IntDir=$(IntDir)\" >> msbuild.rsp
45+
"/p:ExternalsDir=$(ExternalsDir)\" >> msbuild.rsp
46+
"/p:tclDir=$(ExternalsDir)\$(TclSourceTag)\" >> msbuild.rsp
47+
"/p:tkDir=$(ExternalsDir)\$(TkSourceTag)\" >> msbuild.rsp
48+
"/p:tixDir=$(ExternalsDir)\$(TixSourceTag)\" >> msbuild.rsp
49+
displayName: 'Generate msbuild.rsp'
50+
51+
- powershell: |
52+
& "$(msbuild)" PCbuild\tcl.vcxproj "@msbuild.rsp" /p:Platform=Win32 /p:tcltkDir="$(OutDir)\win32"
53+
& "$(msbuild)" PCbuild\tk.vcxproj "@msbuild.rsp" /p:Platform=Win32 /p:tcltkDir="$(OutDir)\win32"
54+
& "$(msbuild)" PCbuild\tix.vcxproj "@msbuild.rsp" /p:Platform=Win32 /p:tcltkDir="$(OutDir)\win32"
55+
displayName: 'Build for win32'
56+
57+
- powershell: |
58+
& "$(msbuild)" PCbuild\tcl.vcxproj "@msbuild.rsp" /p:Platform=x64 /p:tcltkDir="$(OutDir)\amd64"
59+
& "$(msbuild)" PCbuild\tk.vcxproj "@msbuild.rsp" /p:Platform=x64 /p:tcltkDir="$(OutDir)\amd64"
60+
& "$(msbuild)" PCbuild\tix.vcxproj "@msbuild.rsp" /p:Platform=x64 /p:tcltkDir="$(OutDir)\amd64"
61+
displayName: 'Build for amd64'
62+
63+
- publish: '$(OutDir)'
64+
artifact: 'tcltk'
65+
displayName: 'Publishing tcltk'

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +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/deepfreeze/*.c linguist-generated=true
4950
Python/frozen_modules/*.h linguist-generated=true
5051
Python/frozen_modules/MANIFEST linguist-generated=true
5152
Include/internal/pycore_ast.h linguist-generated=true

.github/workflows/posix-deps-apt.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apt-get update
33

44
apt-get -yq install \
55
build-essential \
6+
pkg-config \
67
ccache \
78
gdb \
89
lcov \

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,18 @@ Lib/distutils/command/*.pdb
5959
Lib/lib2to3/*.pickle
6060
Lib/test/data/*
6161
!Lib/test/data/README
62+
/_bootstrap_python
6263
/Makefile
6364
/Makefile.pre
65+
Mac/Makefile
66+
Mac/PythonLauncher/Info.plist
67+
Mac/PythonLauncher/Makefile
68+
Mac/PythonLauncher/Python Launcher
69+
Mac/PythonLauncher/Python Launcher.app/*
70+
Mac/Resources/app/Info.plist
71+
Mac/Resources/framework/Info.plist
72+
Mac/pythonw
73+
/*.framework/
6474
Misc/python.pc
6575
Misc/python-embed.pc
6676
Misc/python-config.sh
@@ -106,6 +116,7 @@ Tools/unicode/data/
106116
/platform
107117
/profile-clean-stamp
108118
/profile-run-stamp
119+
/Python/deepfreeze/*.c
109120
/pybuilddir.txt
110121
/pyconfig.h
111122
/python-config
@@ -120,6 +131,7 @@ Tools/unicode/data/
120131
Tools/msi/obj
121132
Tools/ssl/amd64
122133
Tools/ssl/win32
134+
Tools/freeze/test/outdir
123135

124136
# The frozen modules are always generated by the build so we don't
125137
# keep them in the repo. Also see Tools/scripts/freeze_modules.py.

Doc/c-api/gcsupport.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ Constructors for container types must conform to two rules:
3333
#. Once all the fields which may contain references to other containers are
3434
initialized, it must call :c:func:`PyObject_GC_Track`.
3535

36+
Similarly, the deallocator for the object must conform to a similar pair of
37+
rules:
38+
39+
#. Before fields which refer to other containers are invalidated,
40+
:c:func:`PyObject_GC_UnTrack` must be called.
41+
42+
#. The object's memory must be deallocated using :c:func:`PyObject_GC_Del`.
43+
3644
.. warning::
3745
If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at least
3846
a :c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one
@@ -100,14 +108,6 @@ Constructors for container types must conform to two rules:
100108
101109
.. versionadded:: 3.9
102110
103-
Similarly, the deallocator for the object must conform to a similar pair of
104-
rules:
105-
106-
#. Before fields which refer to other containers are invalidated,
107-
:c:func:`PyObject_GC_UnTrack` must be called.
108-
109-
#. The object's memory must be deallocated using :c:func:`PyObject_GC_Del`.
110-
111111
112112
.. c:function:: void PyObject_GC_Del(void *op)
113113

Doc/c-api/typeobj.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,18 @@ and :c:type:`PyType_Type` effectively act as defaults.)
668668
:c:func:`PyObject_GC_Del` if the instance was allocated using
669669
:c:func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar`.
670670

671+
If the type supports garbage collection (has the :const:`Py_TPFLAGS_HAVE_GC`
672+
flag bit set), the destructor should call :c:func:`PyObject_GC_UnTrack`
673+
before clearing any member fields.
674+
675+
.. code-block:: c
676+
677+
static void foo_dealloc(foo_object *self) {
678+
PyObject_GC_UnTrack(self);
679+
Py_CLEAR(self->ref);
680+
Py_TYPE(self)->tp_free((PyObject *)self);
681+
}
682+
671683
Finally, if the type is heap allocated (:const:`Py_TPFLAGS_HEAPTYPE`), the
672684
deallocator should decrement the reference count for its type object after
673685
calling the type deallocator. In order to avoid dangling pointers, the

Doc/data/stable_abi.dat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ var,PyExc_ArithmeticError,3.2,
189189
var,PyExc_AssertionError,3.2,
190190
var,PyExc_AttributeError,3.2,
191191
var,PyExc_BaseException,3.2,
192+
var,PyExc_BaseExceptionGroup,3.11,
192193
var,PyExc_BlockingIOError,3.7,
193194
var,PyExc_BrokenPipeError,3.7,
194195
var,PyExc_BufferError,3.2,

0 commit comments

Comments
 (0)