gh-114099: Additions to standard library to support iOS
Part of the PEP 730 work to add iOS support.
This PR modifies the standard library and test suite to add support for iOS:
- Adds
platform.ios_ver()to provide iOS platform details like OS version and device. - Modifies
platform.uname()and related functions to run on iOS - Adds an iOS browser implementation for the
webbrowsermodule - Disables the user-site module (as with WASI, there's no real concept of a "user" independent of the system)
- Adds iOS configurations to
sysconfig - Marks a concurrent futures threadpool test as requiring fork. The test has an existing check for a specific feature of fork, and the entire test is skipped if the platform has no threads (e.g., WASI), but there was no specific check for fork.
- Lowers the maximum marshalling stack depth to a value compatible with iOS
- Modifies the
testiosMakefile target to only output test failures once (see this comment)
There is one minor discrepancy with the specification in the PEP - the PEP describes ios_ver() as including the minimum iOS version. This isn't useful at runtime - it's only used to determine binary compatibility - and it's a little fiddly to get access to in the context of the platform module, so I've omitted it.
It's also possible for platform.system to return iPadOS when running on an iPad (although not all iPads, apparently...); I've made the decision to return the native value of [[UIDevice currentDevice] systemName], rather than transform that value.
With this PR in place, the iOS testbed passes with no errors. This is the final set of code changes needed to support iOS; there will be an additional PR to add documentation, plus one for buildbot configurations.
- Issue: gh-114099
📚 Documentation preview 📚: https://cpython-previews--117052.org.readthedocs.build/