python / cpython

The Python programming language
https://www.python.org/
Other
60.06k stars 29.08k forks source link

gh-118201: Accomodate flaky behavior of `os.sysconf` on iOS #118453

Closed freakboy3742 closed 2 weeks ago

freakboy3742 commented 2 weeks ago

A follow on from #118452, addressing a similar class of flaky test on iOS.

os.sysconf() appears to have flakiness similar to that observed with posix.confstr(). So far, it has been less common than the test_posix failure; as with the test_posix case, I've been unable to reproduce it locally, and the next CI pass almost always passes.

One of the updates in this PR is in os_helper, which already has a failover case if os.sysconf() isn't available or doesn't work. I've done a test deliberately simulating the failure case (effectively using the constant value of MAXFD regardless of the sysconf value), and the tests that use this utility continue to pass on iOS.