This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author bergkvist
Recipients bergkvist, ned.deily, ronaldoussoren
Date 2021-08-05.23:48:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1628207328.47.0.372338723813.issue44689@roundup.psfhosted.org>
In-reply-to
Content
This makes a lot of sense now.

Thank you so much for the thorough explanation Ned - and for highlighting where my assumptions were wrong!

I didn’t realise I needed to specify MACOSX_DEPLOYMENT_TARGET to enable backwards compatibility. Is there a reason for not setting this to as old a version as possible by default when running ./configure? (Bigger binaries? Or something else?)

If I understand correctly, the following two statements are now equivalent (in Python >= 3.9, but not in Python == 3.8), after the added Python-support for weak linking you mention:

```
if (__builtin_available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *)) { // ...
If (HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH_RUNTIME) { // ...
```
From: https://github.com/python/cpython/blob/3d315c311676888201f4a3576e4ee3698684a3a2/Modules/_ctypes/callproc.c#L1452


And in order to support the deprecated case of building on an older MacOS-version, I would want to do something like the following:

```
#ifdef __APPLE__
#ifdef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH
// leave current implementation as is
#else
// dynamic loading implementation
#endif
#endif
```

That way, dynamic loading will only be used when building on old MacOS, and we keep the current code path using weak linking when possible.

This means we will still get useful compiler errors if for example Apple decides to suddenly remove the _dyld_shared_cache_contains_path symbol again in the future, or change its signature - rather than having to wait for the test suite to fail. It makes sense to prioritise good error reporting for the latest version of MacOS, since this will reduce the debugging time for CPython developers whenever Apple introduces new breaking changes to MacOS.
History
Date User Action Args
2021-08-05 23:48:48bergkvistsetrecipients: + bergkvist, ronaldoussoren, ned.deily
2021-08-05 23:48:48bergkvistsetmessageid: <1628207328.47.0.372338723813.issue44689@roundup.psfhosted.org>
2021-08-05 23:48:48bergkvistlinkissue44689 messages
2021-08-05 23:48:48bergkvistcreate