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.

classification
Title: python3 time module misses attributes in Mac installers
Type: Stage: resolved
Components: macOS Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Python needs to check existence of functions at runtime for targeting older macOS platforms
View: 34597
Assigned To: Nosy List: jasonli360, ned.deily, ronaldoussoren
Priority: normal Keywords:

Created on 2020-01-03 19:02 by jasonli360, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg359248 - (view) Author: Jason Li (jasonli360) Date: 2020-01-03 19:02
The issue: AttributeError: module 'time' has no attribute 'clock_gettime'. It probably missed other attributes as well.

The problem only appeared with using installers to install python. While Homebrew installed python does not have the issue.

The issue occurred in versions, 3.7.1, 3.7.3, 3.7.4, 3.8.1, as I observed.
msg359254 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-01-03 20:05
This is a duplicate of Issue34597.

The Pythons provided by the python.org macOS installers are built to run on a range of operating system versions.  The current practice is to build installers that work on any macOS version from 10.9 on.  To safely provide that functionality, the installers are built using a 10.9 ABI.  As noted in the time module documentation, "Although this module is always available, not all functions are available on all platforms."  And, as noted in

   man 3 clock_gettime 

For current macOS releases: "These functions first appeared in Mac OSX 10.12".

So since those functions are not available in macOS 10.9, they are not available in the current python.org macOS Pythons.  There are some other examples of this.

To remove this restriction and still allow builds that support a range of versions, we would need to identify the system interfaces that have been added in new releases and then add code to use weak linking to test at runtime to gracefully handle missing interfaces, rather than segfaulting.  It would be desirable to support that but it's a fair amount of work including adding tests and no one has volunteered to do that work - yet.
History
Date User Action Args
2022-04-11 14:59:24adminsetgithub: 83384
2020-01-03 20:05:45ned.deilysetstatus: open -> closed
superseder: Python needs to check existence of functions at runtime for targeting older macOS platforms
messages: + msg359254

type: compile error ->
resolution: duplicate
stage: resolved
2020-01-03 19:02:54jasonli360create