Skip to content

Commit 7913e84

Browse files
authored
Merge branch 'main' into doc-py314-unpicklable
2 parents 94c4734 + 6870eb3 commit 7913e84

File tree

154 files changed

+2084
-785
lines changed

Some content is hidden

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

154 files changed

+2084
-785
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Makefile.pre.in @erlend-aasland
1717
Modules/Setup* @erlend-aasland
1818

1919
# asyncio
20-
**/*asyncio* @1st1 @asvetlov @gvanrossum @kumaraditya303 @willingc
20+
**/*asyncio* @1st1 @asvetlov @kumaraditya303 @willingc
2121

2222
# Core
2323
**/*context* @1st1
@@ -281,4 +281,4 @@ Lib/test/test_configparser.py @jaraco
281281
# Doc sections
282282
Doc/reference/ @willingc
283283

284-
**/*weakref* @kumaraditya303
284+
**/*weakref* @kumaraditya303

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
4747
runs-on: ubuntu-24.04
4848
container:
49-
image: ghcr.io/python/autoconf:2024.10.11.11293396815
49+
image: ghcr.io/python/autoconf:2024.10.16.11360930377
5050
timeout-minutes: 60
5151
needs: check_source
5252
if: needs.check_source.outputs.run_tests == 'true'

Android/android-env.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
: ${HOST:?} # GNU target triplet
44

55
# You may also override the following:
6-
: ${api_level:=21} # Minimum Android API level the build will run on
6+
: ${api_level:=24} # Minimum Android API level the build will run on
77
: ${PREFIX:-} # Path in which to find required libraries
88

99

@@ -24,7 +24,7 @@ fail() {
2424
# * https://android.googlesource.com/platform/ndk/+/ndk-rXX-release/docs/BuildSystemMaintainers.md
2525
# where XX is the NDK version. Do a diff against the version you're upgrading from, e.g.:
2626
# https://android.googlesource.com/platform/ndk/+/ndk-r25-release..ndk-r26-release/docs/BuildSystemMaintainers.md
27-
ndk_version=26.2.11394342
27+
ndk_version=27.1.12297006
2828

2929
ndk=$ANDROID_HOME/ndk/$ndk_version
3030
if ! [ -e $ndk ]; then
@@ -58,8 +58,8 @@ for path in "$AR" "$AS" "$CC" "$CXX" "$LD" "$NM" "$RANLIB" "$READELF" "$STRIP";
5858
fi
5959
done
6060

61-
export CFLAGS=""
62-
export LDFLAGS="-Wl,--build-id=sha1 -Wl,--no-rosegment"
61+
export CFLAGS="-D__BIONIC_NO_PAGE_SIZE_MACRO"
62+
export LDFLAGS="-Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,-z,max-page-size=16384"
6363

6464
# Unlike Linux, Android does not implicitly use a dlopened library to resolve
6565
# relocations in subsequently-loaded libraries, even if RTLD_GLOBAL is used
@@ -85,6 +85,10 @@ if [ -n "${PREFIX:-}" ]; then
8585
export PKG_CONFIG_LIBDIR="$abs_prefix/lib/pkgconfig"
8686
fi
8787

88+
# When compiling C++, some build systems will combine CFLAGS and CXXFLAGS, and some will
89+
# use CXXFLAGS alone.
90+
export CXXFLAGS=$CFLAGS
91+
8892
# Use the same variable name as conda-build
8993
if [ $(uname) = "Darwin" ]; then
9094
export CPU_COUNT=$(sysctl -n hw.ncpu)

Android/android.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ def make_build_python(context):
138138

139139
def unpack_deps(host):
140140
deps_url = "https://github.com/beeware/cpython-android-source-deps/releases/download"
141-
for name_ver in ["bzip2-1.0.8-1", "libffi-3.4.4-2", "openssl-3.0.15-0",
142-
"sqlite-3.45.1-0", "xz-5.4.6-0"]:
141+
for name_ver in ["bzip2-1.0.8-2", "libffi-3.4.4-3", "openssl-3.0.15-4",
142+
"sqlite-3.45.3-3", "xz-5.4.6-1"]:
143143
filename = f"{name_ver}-{host}.tar.gz"
144144
download(f"{deps_url}/{name_ver}/{filename}")
145145
run(["tar", "-xf", filename])
@@ -189,12 +189,13 @@ def configure_host_python(context):
189189

190190
def make_host_python(context):
191191
# The CFLAGS and LDFLAGS set in android-env include the prefix dir, so
192-
# delete any previously-installed Python libs and include files to prevent
193-
# them being used during the build.
192+
# delete any previous Python installation to prevent it being used during
193+
# the build.
194194
host_dir = subdir(context.host)
195195
prefix_dir = host_dir / "prefix"
196196
delete_glob(f"{prefix_dir}/include/python*")
197197
delete_glob(f"{prefix_dir}/lib/libpython*")
198+
delete_glob(f"{prefix_dir}/lib/python*")
198199

199200
os.chdir(host_dir / "build")
200201
run(["make", "-j", str(os.cpu_count())], host=context.host)

Android/testbed/app/build.gradle.kts

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,36 +30,47 @@ val PYTHON_VERSION = file("$PYTHON_DIR/Include/patchlevel.h").useLines {
3030
throw GradleException("Failed to find Python version")
3131
}
3232

33-
android.ndkVersion = file("../../android-env.sh").useLines {
34-
for (line in it) {
35-
val match = """ndk_version=(\S+)""".toRegex().find(line)
36-
if (match != null) {
37-
return@useLines match.groupValues[1]
38-
}
39-
}
40-
throw GradleException("Failed to find NDK version")
41-
}
42-
4333

4434
android {
35+
val androidEnvFile = file("../../android-env.sh").absoluteFile
36+
4537
namespace = "org.python.testbed"
4638
compileSdk = 34
4739

4840
defaultConfig {
4941
applicationId = "org.python.testbed"
50-
minSdk = 21
42+
43+
minSdk = androidEnvFile.useLines {
44+
for (line in it) {
45+
"""api_level:=(\d+)""".toRegex().find(line)?.let {
46+
return@useLines it.groupValues[1].toInt()
47+
}
48+
}
49+
throw GradleException("Failed to find API level in $androidEnvFile")
50+
}
5151
targetSdk = 34
52+
5253
versionCode = 1
5354
versionName = "1.0"
5455

5556
ndk.abiFilters.addAll(ABIS.keys)
5657
externalNativeBuild.cmake.arguments(
5758
"-DPYTHON_CROSS_DIR=$PYTHON_CROSS_DIR",
58-
"-DPYTHON_VERSION=$PYTHON_VERSION")
59+
"-DPYTHON_VERSION=$PYTHON_VERSION",
60+
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON",
61+
)
5962

6063
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
6164
}
6265

66+
ndkVersion = androidEnvFile.useLines {
67+
for (line in it) {
68+
"""ndk_version=(\S+)""".toRegex().find(line)?.let {
69+
return@useLines it.groupValues[1]
70+
}
71+
}
72+
throw GradleException("Failed to find NDK version in $androidEnvFile")
73+
}
6374
externalNativeBuild.cmake {
6475
path("src/main/c/CMakeLists.txt")
6576
}

Android/testbed/app/src/main/c/main_activity.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,12 @@ typedef struct {
3434
int pipe[2];
3535
} StreamInfo;
3636

37+
// The FILE member can't be initialized here because stdout and stderr are not
38+
// compile-time constants. Instead, it's initialized immediately before the
39+
// redirection.
3740
static StreamInfo STREAMS[] = {
38-
{stdout, STDOUT_FILENO, ANDROID_LOG_INFO, "native.stdout", {-1, -1}},
39-
{stderr, STDERR_FILENO, ANDROID_LOG_WARN, "native.stderr", {-1, -1}},
41+
{NULL, STDOUT_FILENO, ANDROID_LOG_INFO, "native.stdout", {-1, -1}},
42+
{NULL, STDERR_FILENO, ANDROID_LOG_WARN, "native.stderr", {-1, -1}},
4043
{NULL, -1, ANDROID_LOG_UNKNOWN, NULL, {-1, -1}},
4144
};
4245

@@ -87,6 +90,8 @@ static char *redirect_stream(StreamInfo *si) {
8790
JNIEXPORT void JNICALL Java_org_python_testbed_PythonTestRunner_redirectStdioToLogcat(
8891
JNIEnv *env, jobject obj
8992
) {
93+
STREAMS[0].file = stdout;
94+
STREAMS[1].file = stderr;
9095
for (StreamInfo *si = STREAMS; si->file; si++) {
9196
char *error_prefix;
9297
if ((error_prefix = redirect_stream(si))) {

Android/testbed/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
plugins {
3-
id("com.android.application") version "8.4.2" apply false
3+
id("com.android.application") version "8.6.1" apply false
44
id("org.jetbrains.kotlin.android") version "1.9.22" apply false
55
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Mon Feb 19 20:29:06 GMT 2024
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

Doc/c-api/type.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,20 @@ The following functions and structs are used to create
413413
Creating classes whose metaclass overrides
414414
:c:member:`~PyTypeObject.tp_new` is no longer allowed.
415415
416+
.. c:function:: int PyType_Freeze(PyTypeObject *type)
417+
418+
Make a type immutable: set the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag.
419+
420+
All base classes of *type* must be immutable.
421+
422+
On success, return ``0``.
423+
On error, set an exception and return ``-1``.
424+
425+
The type must not be used before it's made immutable. For example, type
426+
instances must not be created before the type is made immutable.
427+
428+
.. versionadded:: 3.14
429+
416430
.. raw:: html
417431
418432
<!-- Keep old URL fragments working (see gh-97908) -->

Doc/data/stable_abi.dat

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

0 commit comments

Comments
 (0)