Skip to content

Update patch to Python 3.13.5 #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ BUILD_NUMBER=custom
# of a release cycle, as official binaries won't be published.
# PYTHON_MICRO_VERSION is the full version number, without any alpha/beta/rc suffix. (e.g., 3.10.0)
# PYTHON_VER is the major/minor version (e.g., 3.10)
PYTHON_VERSION=3.13.4
PYTHON_VERSION=3.13.5
PYTHON_PKG_VERSION=$(PYTHON_VERSION)
PYTHON_MICRO_VERSION=$(shell echo $(PYTHON_VERSION) | grep -Eo "\d+\.\d+\.\d+")
PYTHON_PKG_MICRO_VERSION=$(shell echo $(PYTHON_PKG_VERSION) | grep -Eo "\d+\.\d+\.\d+")
Expand Down
184 changes: 149 additions & 35 deletions patch/Python/Python.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
diff --git a/Doc/using/ios.rst b/Doc/using/ios.rst
index dff694941d0..685d8e81add 100644
--- a/Doc/using/ios.rst
+++ b/Doc/using/ios.rst
@@ -296,9 +296,9 @@
* Buffered stdio (:c:member:`PyConfig.buffered_stdio`) is *disabled*;
* Writing bytecode (:c:member:`PyConfig.write_bytecode`) is *disabled*;
* Signal handlers (:c:member:`PyConfig.install_signal_handlers`) are *enabled*;
- * ``PYTHONHOME`` for the interpreter is configured to point at the
+ * :envvar:`PYTHONHOME` for the interpreter is configured to point at the
``python`` subfolder of your app's bundle; and
- * The ``PYTHONPATH`` for the interpreter includes:
+ * The :envvar:`PYTHONPATH` for the interpreter includes:

- the ``python/lib/python3.X`` subfolder of your app's bundle,
- the ``python/lib/python3.X/lib-dynload`` subfolder of your app's bundle, and
@@ -322,7 +322,12 @@
the ``lib-dynload`` folder can be copied and adapted for this purpose.

* If you're using a separate folder for third-party packages, ensure that folder
- is included as part of the ``PYTHONPATH`` configuration in step 10.
+ is included as part of the :envvar:`PYTHONPATH` configuration in step 10.
+
+* If any of the folders that contain third-party packages will contain ``.pth``
+ files, you should add that folder as a *site directory* (using
+ :meth:`site.addsitedir`), rather than adding to :envvar:`PYTHONPATH` or
+ :attr:`sys.path` directly.

Testing a Python package
------------------------
diff --git a/Lib/platform.py b/Lib/platform.py
index 8895177e326..eab586011ed 100755
--- a/Lib/platform.py
Expand Down Expand Up @@ -163,7 +193,7 @@ index f5cd73bdea8..50f2f8988b7 100644
# elif !defined(TARGET_OS_OSX) || TARGET_OS_OSX
PLATFORM_TRIPLET=darwin
diff --git a/configure b/configure
index 1cd1f690f7b..34922ae651e 100755
index 519caa8ca74..5ae6de9bb44 100755
--- a/configure
+++ b/configure
@@ -979,6 +979,8 @@
Expand Down Expand Up @@ -563,7 +593,7 @@ index 1cd1f690f7b..34922ae651e 100755
fi
ac_fn_c_check_func "$LINENO" "fpathconf" "ac_cv_func_fpathconf"
if test "x$ac_cv_func_fpathconf" = xyes
@@ -18486,24 +18617,6 @@
@@ -18492,24 +18623,6 @@
then :
printf "%s\n" "#define HAVE_POSIX_OPENPT 1" >>confdefs.h

Expand All @@ -588,7 +618,7 @@ index 1cd1f690f7b..34922ae651e 100755
fi
ac_fn_c_check_func "$LINENO" "pread" "ac_cv_func_pread"
if test "x$ac_cv_func_pread" = xyes
@@ -18792,12 +18905,6 @@
@@ -18798,12 +18911,6 @@
then :
printf "%s\n" "#define HAVE_SIGACTION 1" >>confdefs.h

Expand All @@ -601,7 +631,7 @@ index 1cd1f690f7b..34922ae651e 100755
fi
ac_fn_c_check_func "$LINENO" "sigfillset" "ac_cv_func_sigfillset"
if test "x$ac_cv_func_sigfillset" = xyes
@@ -19066,11 +19173,11 @@
@@ -19072,11 +19179,11 @@

fi

Expand All @@ -615,7 +645,7 @@ index 1cd1f690f7b..34922ae651e 100755
ac_fn_c_check_func "$LINENO" "getentropy" "ac_cv_func_getentropy"
if test "x$ac_cv_func_getentropy" = xyes
then :
@@ -19092,6 +19199,53 @@
@@ -19098,6 +19205,53 @@

fi

Expand Down Expand Up @@ -669,7 +699,7 @@ index 1cd1f690f7b..34922ae651e 100755
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5
printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; }
if test ${ac_cv_c_undeclared_builtin_options+y}
@@ -21888,7 +22042,8 @@
@@ -21920,7 +22074,8 @@


# check for openpty, login_tty, and forkpty
Expand All @@ -679,7 +709,7 @@ index 1cd1f690f7b..34922ae651e 100755

for ac_func in openpty
do :
@@ -21984,7 +22139,7 @@
@@ -22016,7 +22171,7 @@
fi

done
Expand All @@ -688,15 +718,15 @@ index 1cd1f690f7b..34922ae651e 100755
printf %s "checking for library containing login_tty... " >&6; }
if test ${ac_cv_search_login_tty+y}
then :
@@ -22141,6 +22296,7 @@
@@ -22173,6 +22328,7 @@
fi

done
+fi

# check for long file support functions
ac_fn_c_check_func "$LINENO" "fseek64" "ac_cv_func_fseek64"
@@ -22387,10 +22543,10 @@
@@ -22419,10 +22575,10 @@

done

Expand All @@ -709,7 +739,7 @@ index 1cd1f690f7b..34922ae651e 100755
then

for ac_func in clock_settime
@@ -24622,8 +24778,8 @@
@@ -24654,8 +24810,8 @@
LIBPYTHON="\$(BLDLIBRARY)"
fi

Expand All @@ -720,7 +750,7 @@ index 1cd1f690f7b..34922ae651e 100755
MODULE_DEPS_SHARED="$MODULE_DEPS_SHARED \$(PYTHONFRAMEWORKDIR)/\$(PYTHONFRAMEWORK)"
fi

@@ -27271,7 +27427,7 @@
@@ -27303,7 +27459,7 @@
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for device files" >&5
printf "%s\n" "$as_me: checking for device files" >&6;}

Expand All @@ -729,7 +759,7 @@ index 1cd1f690f7b..34922ae651e 100755
ac_cv_file__dev_ptmx=no
ac_cv_file__dev_ptc=no
else
@@ -27704,7 +27860,7 @@
@@ -27736,7 +27892,7 @@
with_ensurepip=no ;; #(
WASI) :
with_ensurepip=no ;; #(
Expand All @@ -738,7 +768,7 @@ index 1cd1f690f7b..34922ae651e 100755
with_ensurepip=no ;; #(
*) :
with_ensurepip=upgrade
@@ -28723,7 +28879,7 @@
@@ -28755,7 +28911,7 @@
;; #(
Darwin) :
;; #(
Expand All @@ -747,7 +777,7 @@ index 1cd1f690f7b..34922ae651e 100755



@@ -32488,6 +32644,8 @@
@@ -32520,6 +32676,8 @@
"Mac/Resources/framework/Info.plist") CONFIG_FILES="$CONFIG_FILES Mac/Resources/framework/Info.plist" ;;
"Mac/Resources/app/Info.plist") CONFIG_FILES="$CONFIG_FILES Mac/Resources/app/Info.plist" ;;
"iOS/Resources/Info.plist") CONFIG_FILES="$CONFIG_FILES iOS/Resources/Info.plist" ;;
Expand All @@ -757,7 +787,7 @@ index 1cd1f690f7b..34922ae651e 100755
"Misc/python.pc") CONFIG_FILES="$CONFIG_FILES Misc/python.pc" ;;
"Misc/python-embed.pc") CONFIG_FILES="$CONFIG_FILES Misc/python-embed.pc" ;;
diff --git a/configure.ac b/configure.ac
index 3fcb18922c5..3a4167c96ee 100644
index 2a037569e49..39f84269378 100644
--- a/configure.ac
+++ b/configure.ac
@@ -330,6 +330,12 @@
Expand Down Expand Up @@ -1117,7 +1147,7 @@ index 3fcb18922c5..3a4167c96ee 100644
- fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
+ fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
getgrnam_r getgrouplist gethostname getitimer getloadavg getlogin \
getgrnam_r getgrouplist gethostname getitimer getloadavg getlogin getlogin_r \
getpeername getpgid getpid getppid getpriority _getpty \
@@ -5122,15 +5253,14 @@
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
Expand Down Expand Up @@ -1161,8 +1191,8 @@ index 3fcb18922c5..3a4167c96ee 100644
fi

AC_CHECK_DECL([dirfd],
@@ -5401,20 +5539,22 @@
])
@@ -5413,20 +5551,22 @@
[@%:@include <utmp.h>])

# check for openpty, login_tty, and forkpty
-
Expand Down Expand Up @@ -1198,7 +1228,7 @@ index 3fcb18922c5..3a4167c96ee 100644

# check for long file support functions
AC_CHECK_FUNCS([fseek64 fseeko fstatvfs ftell64 ftello statvfs])
@@ -5453,10 +5593,10 @@
@@ -5465,10 +5605,10 @@
])
])

Expand All @@ -1211,7 +1241,7 @@ index 3fcb18922c5..3a4167c96ee 100644
then
AC_CHECK_FUNCS([clock_settime], [], [
AC_CHECK_LIB([rt], [clock_settime], [
@@ -6205,8 +6345,8 @@
@@ -6217,8 +6357,8 @@
LIBPYTHON="\$(BLDLIBRARY)"
fi

Expand All @@ -1222,7 +1252,7 @@ index 3fcb18922c5..3a4167c96ee 100644
MODULE_DEPS_SHARED="$MODULE_DEPS_SHARED \$(PYTHONFRAMEWORKDIR)/\$(PYTHONFRAMEWORK)"
fi

@@ -6814,7 +6954,7 @@
@@ -6826,7 +6966,7 @@
dnl NOTE: Inform user how to proceed with files when cross compiling.
dnl Some cross-compile builds are predictable; they won't ever
dnl have /dev/ptmx or /dev/ptc, so we can set them explicitly.
Expand All @@ -1231,7 +1261,7 @@ index 3fcb18922c5..3a4167c96ee 100644
ac_cv_file__dev_ptmx=no
ac_cv_file__dev_ptc=no
else
@@ -7071,7 +7211,7 @@
@@ -7083,7 +7223,7 @@
AS_CASE([$ac_sys_system],
[Emscripten], [with_ensurepip=no],
[WASI], [with_ensurepip=no],
Expand All @@ -1240,7 +1270,7 @@ index 3fcb18922c5..3a4167c96ee 100644
[with_ensurepip=upgrade]
)
])
@@ -7479,7 +7619,7 @@
@@ -7491,7 +7631,7 @@
[VxWorks*], [PY_STDLIB_MOD_SET_NA([_scproxy], [termios], [grp])],
dnl The _scproxy module is available on macOS
[Darwin], [],
Expand Down Expand Up @@ -1269,19 +1299,103 @@ index c3e261ecd9e..26ef7a95de4 100644
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
diff --git a/iOS/testbed/__main__.py b/iOS/testbed/__main__.py
index c05497ede3a..1146bf3b988 100644
--- a/iOS/testbed/__main__.py
+++ b/iOS/testbed/__main__.py
@@ -127,7 +127,7 @@
async def select_simulator_device():
# List the testing simulators, in JSON format
raw_json = await async_check_output(
- "xcrun", "simctl", "--set", "testing", "list", "-j"
+ "xcrun", "simctl", "list", "-j"
)
json_data = json.loads(raw_json)
--- /dev/null
+++ b/iOS/Resources/bin/arm64-apple-ios-simulator-strip
@@ -0,0 +1,2 @@
+#!/bin/sh
+xcrun --sdk iphonesimulator${IOS_SDK_VERSION} strip -arch arm64 "$@"
--- /dev/null
+++ b/iOS/Resources/bin/arm64-apple-ios-strip
@@ -0,0 +1,2 @@
+#!/bin/sh
+xcrun --sdk iphoneos${IOS_SDK_VERSION} strip -arch arm64 "$@"
--- /dev/null
+++ b/iOS/Resources/bin/x86_64-apple-ios-simulator-strip
@@ -0,0 +1,2 @@
+#!/bin/sh
+xcrun --sdk iphonesimulator${IOS_SDK_VERSION} strip -arch x86_64 "$@"
diff --git a/iOS/testbed/iOSTestbedTests/iOSTestbedTests.m b/iOS/testbed/iOSTestbedTests/iOSTestbedTests.m
index d417b4cd63e..294a06f5305 100644
--- a/iOS/testbed/iOSTestbedTests/iOSTestbedTests.m
+++ b/iOS/testbed/iOSTestbedTests/iOSTestbedTests.m
@@ -15,6 +15,11 @@
PyStatus status;
PyPreConfig preconfig;
PyConfig config;
+ PyObject *app_packages_path;
+ PyObject *method_args;
+ PyObject *result;
+ PyObject *site_module;
+ PyObject *site_addsitedir_attr;
PyObject *sys_module;
PyObject *sys_path_attr;
NSArray *test_args;
@@ -109,29 +114,55 @@
return;
}

- sys_module = PyImport_ImportModule("sys");
- if (sys_module == NULL) {
- XCTFail(@"Could not import sys module");
+ // Add app_packages as a site directory. This both adds to sys.path,
+ // and ensures that any .pth files in that directory will be executed.
+ site_module = PyImport_ImportModule("site");
+ if (site_module == NULL) {
+ XCTFail(@"Could not import site module");
return;
}

- sys_path_attr = PyObject_GetAttrString(sys_module, "path");
- if (sys_path_attr == NULL) {
- XCTFail(@"Could not access sys.path");
+ site_addsitedir_attr = PyObject_GetAttrString(site_module, "addsitedir");
+ if (site_addsitedir_attr == NULL || !PyCallable_Check(site_addsitedir_attr)) {
+ XCTFail(@"Could not access site.addsitedir");
return;
}

- // Add the app packages path
path = [NSString stringWithFormat:@"%@/app_packages", resourcePath, nil];
NSLog(@"App packages path: %@", path);
wtmp_str = Py_DecodeLocale([path UTF8String], NULL);
- failed = PyList_Insert(sys_path_attr, 0, PyUnicode_FromString([path UTF8String]));
- if (failed) {
- XCTFail(@"Unable to add app packages to sys.path");
+ app_packages_path = PyUnicode_FromWideChar(wtmp_str, wcslen(wtmp_str));
+ if (app_packages_path == NULL) {
+ XCTFail(@"Could not convert app_packages path to unicode");
return;
}
PyMem_RawFree(wtmp_str);

+ method_args = Py_BuildValue("(O)", app_packages_path);
+ if (method_args == NULL) {
+ XCTFail(@"Could not create arguments for site.addsitedir");
+ return;
+ }
+
+ result = PyObject_CallObject(site_addsitedir_attr, method_args);
+ if (result == NULL) {
+ XCTFail(@"Could not add app_packages directory using site.addsitedir");
+ return;
+ }
+
+ // Add test code to sys.path
+ sys_module = PyImport_ImportModule("sys");
+ if (sys_module == NULL) {
+ XCTFail(@"Could not import sys module");
+ return;
+ }
+
+ sys_path_attr = PyObject_GetAttrString(sys_module, "path");
+ if (sys_path_attr == NULL) {
+ XCTFail(@"Could not access sys.path");
+ return;
+ }
+
path = [NSString stringWithFormat:@"%@/app", resourcePath, nil];
NSLog(@"App path: %@", path);
wtmp_str = Py_DecodeLocale([path UTF8String], NULL);
--- /dev/null
+++ b/tvOS/README.rst
@@ -0,0 +1,108 @@
Expand Down
Loading