PyDateTime_TIME_GET_TZINFO breaks the Python 3.8 and 3.9 builds
PitfallVerified 6 Oct 2026Holds project: dftracer-utils
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.
Symptom#
Wheel builds for Python 3.8 and 3.9 fail where python/series/convert.cpp uses PyDateTime_TIME_GET_TZINFO.
Cause#
The macro exists only from Python 3.10.
Fix#
Read the hastzinfo field of the time object instead, or guard the call with PY_VERSION_HEX.
Evidence#
Seen in dftracer-utils wheel builds.
Also found by searching
- PyDateTime_TIME_GET_TZINFO undeclared Python 3.9 wheel build
- python 3.8 3.9 wheel build fails in series/convert.cpp
- get tzinfo of a datetime.time object in the C API before 3.10
- PyDateTime_TIME_GET_TZINFO not available