Skip to content

gh-159385: Add support for free-threaded and debug builds for iOS - #159386

Merged
freakboy3742 merged 4 commits into
python:mainfrom
freakboy3742:ios-ft
Oct 14, 2026
Merged

freakboy3742 merged 4 commits into
python:mainfrom
freakboy3742:ios-ft

Conversation

@freakboy3742

@freakboy3742 freakboy3742 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Adds support for generating free-threaded and debug (and debug free-threaded) builds on iOS.

This is achieved by converting the checked-in testbed project into a template that includes {{abiflags}} references wherever the Python library (et al) is referenced. The initial clone of the testbed project makes the testbed "concrete" by filling in the appropriate {{abiflags}} content.

The build commands now include an --abiflags argument that allows t, d and td options; if those options are specified, the build is configured to disable GIL/enable debug as appropriate. This will produce a Python{T|D|TD}.xcframework, and the testbed bundled with the release artefact is rolled out to match the generated framework.

Also includes a GitHub Actions testing configuration.

@bedevere-app bedevere-app Bot added the type-feature A feature request or enhancement label Oct 14, 2026
@freakboy3742

Copy link
Copy Markdown
Contributor Author

FT tests are currently failing because of #159293.

@freakboy3742

Copy link
Copy Markdown
Contributor Author

Merged in the fix from #159311; FT tests are now passing on iOS.

@ned-deily ned-deily left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

It was fairly easy to update my iOS build script to instead build and test a free-threading build or a debug free-threading build.

FWIW, free-threading test run (M4 Pro):
Test Suite 'All tests' passed at 2026-10-14 00:57:17.732. Executed 1 test, with 0 failures (0 unexpected) in 758.194 (758.196) seconds

debug free-threading test run:
[...] in 1123.054 (1123.055) seconds

@freakboy3742
freakboy3742 merged commit d6f2129 into python:main Oct 14, 2026
61 of 63 checks passed
@freakboy3742
freakboy3742 deleted the ios-ft branch October 14, 2026 06:48
@bedevere-bot

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 CentOS9 Refleaks 3.x (tier-1) has failed when building commit d6f2129.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/853/builds/4382) and take a look at the build logs.
  4. Check if the failure is related to this commit (d6f2129) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/853/builds/4382

Failed tests:

  • test.test_multiprocessing_fork.test_processes

Failed subtests:

  • test_interrupt - test.test_multiprocessing_fork.test_processes.WithProcessesTestProcess.test_interrupt

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/contextlib.py", line 116, in inner
    return func(*args, **kwds)
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 651, in test_interrupt
    exitcode = self._kill_process(multiprocessing.Process.interrupt)
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/contextlib.py", line 116, in inner
    return func(*args, **kwds)
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 632, in _kill_process
    self.assertEqual(join(), None)
                     ~~~~^^
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 305, in __call__
    return self.func(*args, **kwds)
           ~~~~~~~~~^^^^^^^^^^^^^^^
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/multiprocessing/process.py", line 156, in join
    res = self._popen.wait(timeout)
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line 44, in wait
    return self.poll(os.WNOHANG if timeout == 0.0 else 0)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line 28, in poll
    pid, sts = os.waitpid(self.pid, flag)
               ~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 628, in handler
    raise RuntimeError('join took too long: %s' % p)
RuntimeError: join took too long: <Process name='Process-964' pid=1925243 parent=1918964 started daemon>


Traceback (most recent call last):
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/multiprocessing/process.py", line 320, in _bootstrap
    self.run()
    ~~~~~~~~^^
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 579, in _sleep_some_event
    time.sleep(100)
    ~~~~~~~~~~^^^^^
KeyboardInterrupt
k


Traceback (most recent call last):
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/contextlib.py", line 116, in inner
    return func(*args, **kwds)
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 651, in test_interrupt
    exitcode = self._kill_process(multiprocessing.Process.interrupt)
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/contextlib.py", line 116, in inner
    return func(*args, **kwds)
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 632, in _kill_process
    self.assertEqual(join(), None)
                     ~~~~^^
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 305, in __call__
    return self.func(*args, **kwds)
           ~~~~~~~~~^^^^^^^^^^^^^^^
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/multiprocessing/process.py", line 156, in join
    res = self._popen.wait(timeout)
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line 44, in wait
    return self.poll(os.WNOHANG if timeout == 0.0 else 0)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/multiprocessing/popen_fork.py", line 28, in poll
    pid, sts = os.waitpid(self.pid, flag)
               ~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 628, in handler
    raise RuntimeError('join took too long: %s' % p)
RuntimeError: join took too long: <Process name='Process-1' pid=2054200 parent=2054198 started daemon>


Traceback (most recent call last):
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/multiprocessing/process.py", line 320, in _bootstrap
    self.run()
    ~~~~~~~~^^
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/test/_test_multiprocessing.py", line 578, in _sleep_some_event
    event.set()
    ~~~~~~~~~^^
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/multiprocessing/synchronize.py", line 349, in set
    with self._cond:
         ^^^^^^^^^^
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/multiprocessing/synchronize.py", line 247, in __exit__
    return self._lock.__exit__(*args)
           ~~~~~~~~~~~~~~~~~~~^^^^^^^
  File "/var/lib/buildbot/worker/cstratak-CentOS9-x86_64/3.x.cstratak-CentOS9-x86_64.refleak/build/Lib/multiprocessing/synchronize.py", line 100, in __exit__
    return self._semlock.__exit__(*args)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
KeyboardInterrupt
k

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this isn't the correct category, although maybe we should add sections for all support platforms (and one for unsupported?)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS, Android, and Emscripten work has always been in a bit of an odd position with blurb - I would'nt object at all to an "other platforms" section in the docs (or however it ends up being spelled) as a better home for this sort of change.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm working on a little patch. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants