Skip to content

Commit cae1308

Browse files
committed
Merge branch 'main' into llvm-version
2 parents a03d668 + 80cdf3e commit cae1308

File tree

196 files changed

+7116
-3432
lines changed

Some content is hidden

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

196 files changed

+7116
-3432
lines changed

.github/workflows/jit.yml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,34 @@ jobs:
134134
make all --jobs 4
135135
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
136136
137+
jit-with-disabled-gil:
138+
name: Free-Threaded (Debug)
139+
needs: interpreter
140+
runs-on: ubuntu-24.04
141+
timeout-minutes: 90
142+
strategy:
143+
fail-fast: false
144+
matrix:
145+
llvm:
146+
- 19
147+
steps:
148+
- uses: actions/checkout@v4
149+
with:
150+
persist-credentials: false
151+
- uses: actions/setup-python@v5
152+
with:
153+
python-version: '3.11'
154+
- name: Build with JIT enabled and GIL disabled
155+
run: |
156+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
157+
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
158+
./configure --enable-experimental-jit --with-pydebug --disable-gil
159+
make all --jobs 4
160+
- name: Run tests
161+
run: |
162+
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
163+
continue-on-error: true
164+
137165
no-opt-jit:
138166
name: JIT without optimizations (Debug)
139167
needs: interpreter
@@ -160,31 +188,3 @@ jobs:
160188
- name: Run tests without optimizations
161189
run: |
162190
PYTHON_UOPS_OPTIMIZE=0 ./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
163-
164-
# XXX: GH-133171
165-
# jit-with-disabled-gil:
166-
# name: Free-Threaded (Debug)
167-
# needs: interpreter
168-
# runs-on: ubuntu-24.04
169-
# timeout-minutes: 90
170-
# strategy:
171-
# fail-fast: false
172-
# matrix:
173-
# llvm:
174-
# - 19
175-
# steps:
176-
# - uses: actions/checkout@v4
177-
# with:
178-
# persist-credentials: false
179-
# - uses: actions/setup-python@v5
180-
# with:
181-
# python-version: '3.11'
182-
# - name: Build with JIT enabled and GIL disabled
183-
# run: |
184-
# sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
185-
# export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
186-
# ./configure --enable-experimental-jit --with-pydebug --disable-gil
187-
# make all --jobs 4
188-
# - name: Run tests
189-
# run: |
190-
# ./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3

Apple/__main__.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def unpack_deps(
316316
for name_ver in [
317317
"BZip2-1.0.8-2",
318318
"libFFI-3.4.7-2",
319-
"OpenSSL-3.0.16-2",
319+
"OpenSSL-3.0.17-1",
320320
"XZ-5.6.4-2",
321321
"mpdecimal-4.0.0-2",
322322
"zstd-1.5.7-1",
@@ -577,6 +577,7 @@ def create_xcframework(platform: str) -> str:
577577

578578
# Extract the package version from the merged framework
579579
version = package_version(package_path / "Python.xcframework")
580+
version_tag = ".".join(version.split(".")[:2])
580581

581582
# On non-macOS platforms, each framework in XCframework only contains the
582583
# headers, libPython, plus an Info.plist. Other resources like the standard
@@ -647,6 +648,23 @@ def create_xcframework(platform: str) -> str:
647648
slice_framework / f"Headers/pyconfig-{arch}.h",
648649
)
649650

651+
# Apple identifies certain libraries as "security risks"; if you
652+
# statically link those libraries into a Framework, you become
653+
# responsible for providing a privacy manifest for that framework.
654+
xcprivacy_file = {
655+
"OpenSSL": subdir(host_triple) / "prefix/share/OpenSSL.xcprivacy"
656+
}
657+
print(f" - {multiarch} xcprivacy files")
658+
for module, lib in [
659+
("_hashlib", "OpenSSL"),
660+
("_ssl", "OpenSSL"),
661+
]:
662+
shutil.copy(
663+
xcprivacy_file[lib],
664+
slice_path
665+
/ f"lib-{arch}/python{version_tag}/lib-dynload/{module}.xcprivacy",
666+
)
667+
650668
print(" - build tools")
651669
shutil.copytree(
652670
PYTHON_DIR / "Apple/testbed/Python.xcframework/build",

Apple/testbed/Python.xcframework/build/utils.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ install_dylib () {
6767

6868
# The name of the extension file
6969
EXT=$(basename "$FULL_EXT")
70+
# The name and location of the module
71+
MODULE_PATH=$(dirname "$FULL_EXT")
72+
MODULE_NAME=$(echo $EXT | cut -d "." -f 1)
7073
# The location of the extension file, relative to the bundle
7174
RELATIVE_EXT=${FULL_EXT#$CODESIGNING_FOLDER_PATH/}
7275
# The path to the extension file, relative to the install base
@@ -94,6 +97,16 @@ install_dylib () {
9497
# Create a back reference to the .so file location in the framework
9598
echo "${RELATIVE_EXT%.so}.fwork" > "$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/$FULL_MODULE_NAME.origin"
9699

100+
# If the framework provides an xcprivacy file, install it.
101+
if [ -e "$MODULE_PATH/$MODULE_NAME.xcprivacy" ]; then
102+
echo "Installing XCPrivacy file for $FRAMEWORK_FOLDER/$FULL_MODULE_NAME"
103+
XCPRIVACY_FILE="$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/PrivacyInfo.xcprivacy"
104+
if [ -e "$XCPRIVACY_FILE" ]; then
105+
rm -rf "$XCPRIVACY_FILE"
106+
fi
107+
mv "$MODULE_PATH/$MODULE_NAME.xcprivacy" "$XCPRIVACY_FILE"
108+
fi
109+
97110
echo "Signing framework as $EXPANDED_CODE_SIGN_IDENTITY_NAME ($EXPANDED_CODE_SIGN_IDENTITY)..."
98111
/usr/bin/codesign --force --sign "$EXPANDED_CODE_SIGN_IDENTITY" ${OTHER_CODE_SIGN_FLAGS:-} -o runtime --timestamp=none --preserve-metadata=identifier,entitlements,flags --generate-entitlement-der "$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER"
99112
}

Doc/c-api/init.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,6 +1382,9 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
13821382
This is not a replacement for :c:func:`PyModule_GetState()`, which
13831383
extensions should use to store interpreter-specific state information.
13841384
1385+
The returned dictionary is borrowed from the interpreter and is valid until
1386+
interpreter shutdown.
1387+
13851388
.. versionadded:: 3.8
13861389
13871390

Doc/c-api/weakref.rst

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -64,30 +64,6 @@ as much as it can.
6464
.. versionadded:: 3.13
6565
6666
67-
.. c:function:: PyObject* PyWeakref_GetObject(PyObject *ref)
68-
69-
Return a :term:`borrowed reference` to the referenced object from a weak
70-
reference, *ref*. If the referent is no longer live, returns ``Py_None``.
71-
72-
.. note::
73-
74-
This function returns a :term:`borrowed reference` to the referenced object.
75-
This means that you should always call :c:func:`Py_INCREF` on the object
76-
except when it cannot be destroyed before the last usage of the borrowed
77-
reference.
78-
79-
.. deprecated-removed:: 3.13 3.15
80-
Use :c:func:`PyWeakref_GetRef` instead.
81-
82-
83-
.. c:function:: PyObject* PyWeakref_GET_OBJECT(PyObject *ref)
84-
85-
Similar to :c:func:`PyWeakref_GetObject`, but does no error checking.
86-
87-
.. deprecated-removed:: 3.13 3.15
88-
Use :c:func:`PyWeakref_GetRef` instead.
89-
90-
9167
.. c:function:: int PyWeakref_IsDead(PyObject *ref)
9268
9369
Test if the weak reference *ref* is dead. Returns 1 if the reference is

Doc/data/refcounts.dat

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,9 @@ PyInterpreterState_Clear:PyInterpreterState*:interp::
11411141
PyInterpreterState_Delete:void:::
11421142
PyInterpreterState_Delete:PyInterpreterState*:interp::
11431143

1144+
PyInterpreterState_GetDict:PyObject*::0:
1145+
PyInterpreterState_GetDict:PyInterpreterState*:interp::
1146+
11441147
PyInterpreterState_GetID:int64_t:::
11451148
PyInterpreterState_GetID:PyInterpreterState*:interp::
11461149

@@ -2947,12 +2950,6 @@ PyWeakref_CheckProxy:PyObject*:ob:0:
29472950
PyWeakref_CheckRef:int:::
29482951
PyWeakref_CheckRef:PyObject*:ob:0:
29492952

2950-
PyWeakref_GET_OBJECT:PyObject*::0:
2951-
PyWeakref_GET_OBJECT:PyObject*:ref:0:
2952-
2953-
PyWeakref_GetObject:PyObject*::0:
2954-
PyWeakref_GetObject:PyObject*:ref:0:
2955-
29562953
PyWeakref_GetRef:int:::
29572954
PyWeakref_GetRef:PyObject*:ref:0:
29582955
PyWeakref_GetRef:PyObject**:pobj:+1:

Doc/data/stable_abi.dat

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/deprecations/c-api-pending-removal-in-3.15.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Pending removal in Python 3.15
33

44
* The :c:func:`!PyImport_ImportModuleNoBlock`:
55
Use :c:func:`PyImport_ImportModule` instead.
6-
* :c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`:
6+
* :c:func:`!PyWeakref_GetObject` and :c:func:`!PyWeakref_GET_OBJECT`:
77
Use :c:func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project
88
<https://github.com/python/pythoncapi-compat/>`__ can be used to get
99
:c:func:`PyWeakref_GetRef` on Python 3.12 and older.

Doc/deprecations/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Deprecations
99

1010
.. include:: pending-removal-in-3.19.rst
1111

12+
.. include:: pending-removal-in-3.20.rst
13+
1214
.. include:: pending-removal-in-future.rst
1315

1416
C API deprecations
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Pending removal in Python 3.20
2+
------------------------------
3+
4+
* The ``__version__`` attribute has been deprecated in these standard library
5+
modules and will be removed in Python 3.20.
6+
Use :py:data:`sys.version_info` instead.
7+
8+
- :mod:`argparse`
9+
- :mod:`csv`
10+
- :mod:`!ctypes.macholib`
11+
- :mod:`ipaddress`
12+
- :mod:`json`
13+
- :mod:`logging` (``__date__`` also deprecated)
14+
- :mod:`optparse`
15+
- :mod:`pickle`
16+
- :mod:`platform`
17+
- :mod:`re`
18+
- :mod:`socketserver`
19+
- :mod:`tabnanny`
20+
- :mod:`tkinter.font`
21+
- :mod:`tkinter.ttk`
22+
23+
(Contributed by Hugo van Kemenade in :gh:`76007`.)

0 commit comments

Comments
 (0)