Skip to content

Commit ae548ee

Browse files
committed
Squashed commit of the following:
commit a228887 Author: John Zhou <[email protected]> Date: Sat May 17 19:53:30 2025 -0500 https://en.wikipedia.org/wiki/Memory_leak#Pseudocode commit 78eb704 Author: John Zhou <[email protected]> Date: Thu May 15 22:12:29 2025 -0500 Revert "try to build multiprocessing" This reverts commit 4e92456. commit 687916e Author: John Zhou <[email protected]> Date: Thu May 15 22:07:48 2025 -0500 try to build multiprocessing commit 02be1ef Author: John Zhou <[email protected]> Date: Thu May 15 18:31:47 2025 -0500 misc fixes commit 1ff1574 Author: John Zhou <[email protected]> Date: Thu May 15 17:14:16 2025 -0500 why do i forget to handle exceptions??? commit ff71f93 Author: John Zhou <[email protected]> Date: Thu May 15 16:54:10 2025 -0500 grumble commit 8d3f831 Author: John Zhou <[email protected]> Date: Wed May 14 20:23:37 2025 -0500 grumble commit 5d73cfc Author: John Zhou <[email protected]> Date: Wed May 14 20:17:51 2025 -0500 fix test_os commit 084a83c Author: John Zhou <[email protected]> Date: Sat May 10 21:50:13 2025 -0500 disable sandbox commit c8227e4 Author: John Zhou <[email protected]> Date: Thu May 8 22:07:42 2025 -0500 platform fix commit 00c08c3 Author: John Zhou <[email protected]> Date: Thu May 8 21:28:54 2025 -0500 fix platform on tvOS et. al. commit 63433a6 Author: John Zhou <[email protected]> Date: Mon May 5 20:57:35 2025 -0500 add a missing file commit 9930836 Author: John Zhou <[email protected]> Date: Sat May 10 07:42:54 2025 -0500 use python for build commit 1ee48cd Author: John Zhou <[email protected]> Date: Sat May 3 19:23:52 2025 -0500 install binaries commit 19e8d64 Author: John Zhou <[email protected]> Date: Sat May 3 14:39:59 2025 -0500 merge test commands commit 639bf33 Author: John Zhou <[email protected]> Date: Sat May 3 09:02:19 2025 -0500 elif commit f1b9686 Author: John Zhou <[email protected]> Date: Sat May 3 09:00:09 2025 -0500 another fix commit 7253cdd Author: John Zhou <[email protected]> Date: Sat May 3 08:53:54 2025 -0500 fix test commit ab9480e Author: John Zhou <[email protected]> Date: Fri May 2 20:54:59 2025 -0500 grumble commit 5ec2564 Author: John Zhou <[email protected]> Date: Fri May 2 20:50:18 2025 -0500 nvm that did not work commit 59e62e6 Author: John Zhou <[email protected]> Date: Fri May 2 20:34:26 2025 -0500 more fixes, also parallel commit da68fb6 Author: John Zhou <[email protected]> Date: Fri May 2 18:49:29 2025 -0500 remove irrel comment commit d662098 Author: John <[email protected]> Date: Fri May 2 18:44:00 2025 -0500 Update test_util.py commit 06e8510 Author: John <[email protected]> Date: Fri May 2 18:43:24 2025 -0500 Update test_loader.py commit daf3275 Author: John <[email protected]> Date: Fri May 2 18:42:41 2025 -0500 Update __init__.py commit aaf27df Author: John <[email protected]> Date: Fri May 2 18:41:56 2025 -0500 Update test_misc.py commit 1588275 Author: John <[email protected]> Date: Fri May 2 18:41:24 2025 -0500 Update datetimetester.py commit fc008b8 Author: John Zhou <[email protected]> Date: Fri May 2 18:44:37 2025 -0500 stuff commit da006cc Author: John Zhou <[email protected]> Date: Fri May 2 18:40:58 2025 -0500 add flag for fwork commit ad7a0e1 Author: John Zhou <[email protected]> Date: Fri May 2 18:34:53 2025 -0500 haaaands commit a29e718 Author: John Zhou <[email protected]> Date: Fri May 2 18:26:38 2025 -0500 yet another error commit 8b41226 Author: John Zhou <[email protected]> Date: Fri May 2 18:08:23 2025 -0500 outdated message commit 6c07c00 Author: John Zhou <[email protected]> Date: Thu May 1 21:49:34 2025 -0500 more fixups commit 897e182 Author: John Zhou <[email protected]> Date: Thu May 1 20:58:06 2025 -0500 another ref commit 5edde3a Author: John Zhou <[email protected]> Date: Tue Apr 29 20:12:19 2025 -0500 whitespace commit 3ece1d6 Author: John Zhou <[email protected]> Date: Tue Apr 29 18:11:42 2025 -0500 I'm not sure if multiprocessing is available... commit c47a04b Author: John Zhou <[email protected]> Date: Tue Apr 29 17:39:16 2025 -0500 enable testing stuff commit fecd3b5 Author: John Zhou <[email protected]> Date: Tue Apr 29 17:23:02 2025 -0500 support fork, fix another appleframeworkloader reference commit 834b207 Author: John Zhou <[email protected]> Date: Tue Apr 29 16:52:59 2025 -0500 detect mac catalyst in datetimetester commit 03a40b1 Author: John Zhou <[email protected]> Date: Tue Apr 29 07:47:53 2025 -0500 use sys commit 849e276 Author: John Zhou <[email protected]> Date: Tue Apr 29 07:28:55 2025 -0500 bootstrap external cleanup` commit 65e3bf8 Author: John Zhou <[email protected]> Date: Tue Apr 29 07:20:31 2025 -0500 (untested) add mac catalyst detection commit 8e008c4 Author: John Zhou <[email protected]> Date: Mon Apr 28 21:37:37 2025 -0500 minor adjustments to test script commit 3d539a4 Author: John Zhou <[email protected]> Date: Mon Apr 28 21:30:45 2025 -0500 disable lib valid + use ad hoc commit d16af17 Author: John Zhou <[email protected]> Date: Sun Apr 27 21:49:08 2025 -0500 change the regex for catalyst and add if commit 823d7b6 Author: John Zhou <[email protected]> Date: Sun Apr 27 21:43:57 2025 -0500 add missing entitlemnet commit 5604df8 Author: John Zhou <[email protected]> Date: Sun Apr 27 21:32:21 2025 -0500 whitespace commit 5f767fd Author: John Zhou <[email protected]> Date: Tue Jun 3 08:12:12 2025 -0500 glue for testbed commit e7b83ae Author: John Zhou <[email protected]> Date: Sun Apr 27 18:11:17 2025 -0500 fix plist commit de0ab4d Author: John Zhou <[email protected]> Date: Sun Apr 27 18:09:32 2025 -0500 address review commit 87482cd Author: John <[email protected]> Date: Sun Apr 27 14:53:52 2025 -0500 Delete MacCatalyst/Resources/pyconfig.h commit 2e971be Author: John Zhou <[email protected]> Date: Sun Apr 27 12:27:10 2025 -0500 plist adjustments + kill maccatalyst testbed revert changes commit 8d186e3 Author: John Zhou <[email protected]> Date: Sun Apr 27 11:40:04 2025 -0500 esac commit 1a20cd7 Author: John Zhou <[email protected]> Date: Sun Apr 27 11:38:09 2025 -0500 fixes for plist commit f00cadf Author: John Zhou <[email protected]> Date: Sun Apr 27 10:47:38 2025 -0500 git rebase cleanup commit 956cfbd Author: John Zhou <[email protected]> Date: Sat Apr 26 07:00:24 2025 -0500 Remove ignored files from tracking commit 3828ce4 Author: John Zhou <[email protected]> Date: Sat Apr 26 07:00:09 2025 -0500 remove more ios refs commit bd99ef5 Author: John Zhou <[email protected]> Date: Sat Apr 26 06:49:55 2025 -0500 testbed commit 2479a35 Author: John Zhou <[email protected]> Date: Sat Apr 26 06:11:51 2025 -0500 here more code commit b3adac4 Author: John Zhou <[email protected]> Date: Sat Apr 26 05:50:09 2025 -0500 fix commit ce636cd Author: John Zhou <[email protected]> Date: Sat Apr 26 05:47:45 2025 -0500 rpath fix w/ embedded commit e0ec373 Author: John Zhou <[email protected]> Date: Sun Apr 27 10:46:32 2025 -0500 Minor cleanups. commit 4071f1d Author: John Zhou <[email protected]> Date: Fri Apr 25 20:36:44 2025 -0500 remove useless stuff. commit 54856e3 Author: John Zhou <[email protected]> Date: Fri Apr 25 18:48:41 2025 -0500 another fix commit 97598c4 Author: John Zhou <[email protected]> Date: Fri Apr 25 18:43:42 2025 -0500 another fix commit f39ed64 Author: John Zhou <[email protected]> Date: Fri Apr 25 18:38:12 2025 -0500 more changes to configure commit 9de10c0 Author: John Zhou <[email protected]> Date: Fri Apr 25 18:30:44 2025 -0500 Add supp for mac catalyst Co-Authored-By: Andrew Savva <[email protected]>
1 parent 7926253 commit ae548ee

35 files changed

+573
-141
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ iOS/testbed/Python.xcframework/ios-*/Python.framework
8282
iOS/testbed/iOSTestbed.xcodeproj/project.xcworkspace
8383
iOS/testbed/iOSTestbed.xcodeproj/xcuserdata
8484
iOS/testbed/iOSTestbed.xcodeproj/xcshareddata
85+
MacCatalyst/Resources/Info.plist
8586
visionOS/testbed/Python.xcframework/xros-*/bin
8687
visionOS/testbed/Python.xcframework/xros-*/include
8788
visionOS/testbed/Python.xcframework/xros-*/lib

Lib/_ios_support.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
def get_platform_ios():
2626
# Determine if this is a simulator using the multiarch value
2727
is_simulator = sys.implementation._multiarch.endswith("simulator")
28+
is_catalyst = sys.implementation._multiarch.endswith("macabi")
2829

2930
# We can't use ctypes; abort
3031
if not objc:
@@ -68,4 +69,4 @@ def get_platform_ios():
6869
release = objc.objc_msgSend(device_systemVersion, SEL_UTF8String).decode()
6970
model = objc.objc_msgSend(device_model, SEL_UTF8String).decode()
7071

71-
return system, release, model, is_simulator
72+
return system, release, model, is_simulator, is_catalyst

Lib/importlib/_bootstrap_external.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1535,7 +1535,8 @@ def _get_supported_file_loaders():
15351535
"""
15361536
extension_loaders = []
15371537
if hasattr(_imp, 'create_dynamic'):
1538-
if sys.platform in {"ios", "tvos", "watchos", "visionos"}:
1538+
# Mac Catalyst does NOT use the AppleFrameworkLoader.
1539+
if sys.platform in {"ios", "tvos", "watchos", "visionos"} and not sys.implementation._multiarch.endswith("macabi"):
15391540
extension_loaders = [(AppleFrameworkLoader, [
15401541
suffix.replace(".so", ".fwork")
15411542
for suffix in _imp.extension_suffixes()

Lib/platform.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -508,11 +508,11 @@ def mac_ver(release='', versioninfo=('', '', ''), machine=''):
508508
# A namedtuple for iOS version information.
509509
IOSVersionInfo = collections.namedtuple(
510510
"IOSVersionInfo",
511-
["system", "release", "model", "is_simulator"]
511+
["system", "release", "model", "is_simulator", "is_catalyst"]
512512
)
513513

514514

515-
def ios_ver(system="", release="", model="", is_simulator=False):
515+
def ios_ver(system="", release="", model="", is_simulator=False, is_catalyst=False):
516516
"""Get iOS version information, and return it as a namedtuple:
517517
(system, release, model, is_simulator).
518518
@@ -525,7 +525,7 @@ def ios_ver(system="", release="", model="", is_simulator=False):
525525
if result is not None:
526526
return IOSVersionInfo(*result)
527527

528-
return IOSVersionInfo(system, release, model, is_simulator)
528+
return IOSVersionInfo(system, release, model, is_simulator, is_catalyst)
529529

530530

531531
# A namedtuple for tvOS version information.
@@ -547,6 +547,7 @@ def tvos_ver(system="", release="", model="", is_simulator=False):
547547
import _ios_support
548548
result = _ios_support.get_platform_ios()
549549
if result is not None:
550+
result = result[:-1] # ignore the Catalyst flag
550551
return TVOSVersionInfo(*result)
551552

552553
return TVOSVersionInfo(system, release, model, is_simulator)
@@ -571,6 +572,7 @@ def watchos_ver(system="", release="", model="", is_simulator=False):
571572
import _ios_support
572573
result = _ios_support.get_platform_ios()
573574
if result is not None:
575+
result = result[:-1] # ignore the Catalyst flag
574576
return WatchOSVersionInfo(*result)
575577

576578
return WatchOSVersionInfo(system, release, model, is_simulator)
@@ -595,6 +597,7 @@ def visionos_ver(system="", release="", model="", is_simulator=False):
595597
import _ios_support
596598
result = _ios_support.get_platform_ios()
597599
if result is not None:
600+
result = result[:-1] # ignore the Catalyst flag
598601
return VisionOSVersionInfo(*result)
599602

600603
return VisionOSVersionInfo(system, release, model, is_simulator)
@@ -968,7 +971,7 @@ def get_OpenVMS():
968971
# there's only one CPU architecture for devices, so we know the right
969972
# answer.
970973
def get_ios():
971-
if sys.implementation._multiarch.endswith("simulator"):
974+
if sys.implementation._multiarch.endswith("simulator") or sys.implementation._multiarch.endswith("macabi"):
972975
return os.uname().machine
973976
return 'arm64'
974977

@@ -1148,7 +1151,7 @@ def uname():
11481151

11491152
# Normalize responses on Apple mobile platforms
11501153
if sys.platform == 'ios':
1151-
system, release, _, _ = ios_ver()
1154+
system, release, _, _, _ = ios_ver()
11521155
if sys.platform == 'tvos':
11531156
system, release, _, _ = tvos_ver()
11541157
if sys.platform == 'watchos':
@@ -1443,7 +1446,7 @@ def platform(aliased=False, terse=False):
14431446
if system == 'Darwin':
14441447
# macOS and iOS both report as a "Darwin" kernel
14451448
if sys.platform == "ios":
1446-
system, release, _, _ = ios_ver()
1449+
system, release, _, _, _ = ios_ver()
14471450
elif sys.platform == "tvos":
14481451
system, release, _, _ = tvos_ver()
14491452
elif sys.platform == "watchos":

Lib/subprocess.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@
7575
_mswindows = True
7676

7777
# some platforms do not support subprocesses
78-
_can_fork_exec = sys.platform not in {"emscripten", "wasi", "ios", "tvos", "watchos", "visionos"}
78+
_can_fork_exec = (
79+
sys.platform not in {"emscripten", "wasi", "ios", "tvos", "watchos", "visionos"}
80+
or sys.implementation._multiarch.endswith("macabi")
81+
)
7982

8083
if _mswindows:
8184
import _winapi

Lib/test/datetimetester.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7159,9 +7159,9 @@ def test_datetime_from_timestamp(self):
71597159
self.assertEqual(dt_orig, dt_rt)
71607160

71617161
def test_type_check_in_subinterp(self):
7162-
# Apple mobile platforms require the use of the custom framework loader,
7163-
# not the ExtensionFileLoader.
7164-
if support.is_apple_mobile:
7162+
# Apple mobile platforms EXCEPT Mac Catalyst require the use of the
7163+
# custom framework loader, not the ExtensionFileLoader.
7164+
if support.needs_apple_fworks:
71657165
extension_loader = "AppleFrameworkLoader"
71667166
else:
71677167
extension_loader = "ExtensionFileLoader"

Lib/test/support/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
# sys
4747
"MS_WINDOWS", "is_jython", "is_android", "is_emscripten", "is_wasi",
4848
"is_apple_mobile", "check_impl_detail", "unix_shell", "setswitchinterval",
49+
"is_mac_catalyst", "needs_apple_fworks",
4950
# os
5051
"get_pagesize",
5152
# network
@@ -576,6 +577,8 @@ def skip_wasi_stack_overflow():
576577

577578
is_apple_mobile = sys.platform in {"ios", "tvos", "watchos", "visionos"}
578579
is_apple = is_apple_mobile or sys.platform == "darwin"
580+
is_mac_catalyst = sys.implementation._multiarch.endswith("macabi")
581+
needs_apple_fworks = is_apple_mobile and not is_mac_catalyst
579582

580583
has_fork_support = hasattr(os, "fork") and not (
581584
# WASM and Apple mobile platforms do not support subprocesses.
@@ -586,6 +589,9 @@ def skip_wasi_stack_overflow():
586589
# Although Android supports fork, it's unsafe to call it from Python because
587590
# all Android apps are multi-threaded.
588591
or is_android
592+
593+
# Mac Catalyst supports subprocesses.
594+
and not is_mac_catalyst
589595
)
590596

591597
def requires_fork():
@@ -601,6 +607,9 @@ def requires_fork():
601607
# practice (see PEP 738). And most of the tests that use them are calling
602608
# sys.executable, which won't work when Python is embedded in an Android app.
603609
or is_android
610+
611+
# Mac Catalyst supports subprocesses.
612+
and not is_mac_catalyst
604613
)
605614

606615
def requires_subprocess():

Lib/test/test_capi/test_misc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,7 +1920,7 @@ def test_module_state_shared_in_global(self):
19201920

19211921
# Apple extensions must be distributed as frameworks. This requires
19221922
# a specialist loader.
1923-
if support.is_apple_mobile:
1923+
if support.needs_apple_fworks:
19241924
loader = "AppleFrameworkLoader"
19251925
else:
19261926
loader = "ExtensionFileLoader"
@@ -2604,7 +2604,7 @@ def setUp(self):
26042604
origin = importlib.util.find_spec('_testmultiphase').origin
26052605
# Apple extensions must be distributed as frameworks. This requires
26062606
# a specialist loader.
2607-
if support.is_apple_mobile:
2607+
if support.needs_apple_fworks:
26082608
loader = importlib.machinery.AppleFrameworkLoader(fullname, origin)
26092609
else:
26102610
loader = importlib.machinery.ExtensionFileLoader(fullname, origin)

Lib/test/test_import/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
swap_attr,
3434
swap_item,
3535
cpython_only,
36-
is_apple_mobile,
36+
needs_apple_fworks,
3737
is_emscripten,
3838
is_wasi,
3939
run_in_subinterp,
@@ -111,7 +111,7 @@ def require_builtin(module, *, skip=False):
111111
def require_extension(module, *, skip=False):
112112
# Apple extensions must be distributed as frameworks. This requires
113113
# a specialist loader.
114-
if is_apple_mobile:
114+
if needs_apple_fworks:
115115
_require_loader(module, AppleFrameworkLoader, skip)
116116
else:
117117
_require_loader(module, ExtensionFileLoader, skip)
@@ -126,7 +126,7 @@ def require_pure_python(module, *, skip=False):
126126
def create_extension_loader(modname, filename):
127127
# Apple extensions must be distributed as frameworks. This requires
128128
# a specialist loader.
129-
if is_apple_mobile:
129+
if needs_apple_fworks:
130130
return AppleFrameworkLoader(modname, filename)
131131
else:
132132
return ExtensionFileLoader(modname, filename)
@@ -2217,7 +2217,7 @@ def import_script(self, name, fd, filename=None, check_override=None):
22172217
if filename:
22182218
# Apple extensions must be distributed as frameworks. This requires
22192219
# a specialist loader.
2220-
if is_apple_mobile:
2220+
if needs_apple_fworks:
22212221
loader = "AppleFrameworkLoader"
22222222
else:
22232223
loader = "ExtensionFileLoader"
@@ -2692,7 +2692,7 @@ def setUpClass(cls):
26922692
# Apple extensions must be distributed as frameworks. This requires
26932693
# a specialist loader, and we need to differentiate between the
26942694
# spec.origin and the original file location.
2695-
if is_apple_mobile:
2695+
if needs_apple_fworks:
26962696
assert cls.LOADER is AppleFrameworkLoader
26972697

26982698
cls.ORIGIN = spec.origin

Lib/test/test_importlib/extension/test_finder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from test.support import is_apple_mobile
1+
from test.support import needs_apple_fworks
22
from test.test_importlib import abc, util
33

44
machinery = util.import_importlib('importlib.machinery')
@@ -20,7 +20,7 @@ def setUp(self):
2020
)
2121

2222
def find_spec(self, fullname):
23-
if is_apple_mobile:
23+
if needs_apple_fworks:
2424
# Apple mobile platforms require a specialist loader that uses
2525
# .fwork files as placeholders for the true `.so` files.
2626
loaders = [

0 commit comments

Comments
 (0)