8000 Merge remote-tracking branch 'upstream/main' into gh-125028-prohibit-… · dg-pb/cpython@c7ee84b · GitHub
[go: up one dir, main page]

Skip to content

Commit c7ee84b

Browse files
committed
Merge remote-tracking branch 'upstream/main' into pythongh-125028-prohibit-kw-placeholders
2 parents f346390 + 19e93e2 commit c7ee84b

File tree

321 files changed

+8047
-3098
lines changed

Some content is hidden

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

321 files changed

+8047
-3098
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: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,50 @@ jobs:
4040
if: fromJSON(needs.check_source.outputs.run-docs)
4141
uses: ./.github/workflows/reusable-docs.yml
4242

43+
check_autoconf_regen:
44+
name: 'Check if Autoconf files are up to date'
45+
# Don't use ubuntu-latest but a specific version to make the job
46+
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
47+
runs-on: ubuntu-24.04
48+
container:
49+
image: ghcr.io/python/autoconf:2024.10.16.11360930377
50+
timeout-minutes: 60
51+
needs: check_source
52+
if: needs.check_source.outputs.run_tests == 'true'
53+
steps:
54+
- name: Install Git
55+
run: |
56+
apt install git -yq
57+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
58+
- uses: actions/checkout@v4
59+
with:
60+
fetch-depth: 1
61+
- name: Runner image version
62+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
63+
- name: Check Autoconf and aclocal versions
64+
run: |
65+
grep "Generated by GNU Autoconf 2.71" configure
66+
grep "aclocal 1.16.5" aclocal.m4
67+
grep -q "runstatedir" configure
68+
grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
69+
- name: Regenerate autoconf files
70+
# Same command used by Tools/build/regen-configure.sh ($AUTORECONF)
71+
run: autoreconf -ivf -Werror
72+
- name: Check for changes
73+
run: |
74+
git add -u
75+
changes=$(git status --porcelain)
76+
# Check for changes in regenerated files
77+
if test -n "$changes"; then
78+
echo "Generated files not up to date."
79+
echo "Perhaps you forgot to run make regen-all or build.bat --regen. ;)"
80+
echo "configure files must be regenerated with a specific version of autoconf."
81+
echo "$changes"
82+
echo ""
83+
git diff --staged || true
84+
exit 1
85+
fi
86+
4387
check_generated_files:
4488
name: 'Check if generated files are up to date'
4589
# Don't use ubuntu-latest but a specific version to make the job
@@ -69,19 +113,10 @@ jobs:
69113
uses: hendrikmuhs/ccache-action@v1.2
70114
with:
71115
save: false
72-
- name: Check Autoconf and aclocal versions
73-
run: |
74-
grep "Generated by GNU Autoconf 2.71" configure
75-
grep "aclocal 1.16.5" aclocal.m4
76-
grep -q "runstatedir" configure
77-
grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
78116
- name: Configure CPython
79117
run: |
80118
# Build Python with the libpython dynamic library
81119
./configure --config-cache --with-pydebug --enable-shared
82-
- name: Regenerate autoconf files
83-
# Same command used by Tools/build/regen-configure.sh ($AUTORECONF)
84-
run: autoreconf -ivf -Werror
85120
- name: Build CPython
86121
run: |
87122
make -j4 regen-all
@@ -501,6 +536,7 @@ jobs:
501536
needs:
502537
- check_source # Transitive dependency, needed to access `run_tests` value
503538
- check-docs
539+
- check_autoconf_regen
504540
- check_generated_files
505541
- build_macos
506542
- build_ubuntu
@@ -536,6 +572,7 @@ jobs:
536572
${{
537573
needs.check_source.outputs.run_tests != 'true'
538574
&& '
575+
check_autoconf_regen,
539576
check_generated_files,
540577
build_macos,
541578
build_ubuntu,

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#!/bin/sh
22
apt-get update
33

4-
# autoconf-archive is needed by autoreconf (check_generated_files job)
54
apt-get -yq install \
65
build-essential \
76
pkg-config \
8-
autoconf-archive \
97
ccache \
108
gdb \
119
lcov \

.github/workflows/reusable-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
- name: 'Set up Python'
8585
uses: actions/setup-python@v5
8686
with:
87-
python-version: '3.12' # known to work with Sphinx 6.2.1
87+
python-version: '3.13' # known to work with Sphinx 7.2.6
8888
cache: 'pip'
8989
cache-dependency-path: 'Doc/requirements-oldest-sphinx.txt'
9090
- name: 'Install build dependencies'

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
) {
< C6AE /td>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

0 commit comments

Comments
 (0)
0