I'm currently working with the cpython datetime api attempting to write pybind11 bindings for Howard Hinnant's date library zoned_time objects and to do so I must perform bidirectional conversions between Howard Hinnant's TimeZone and the cpython PyDateTime_TZInfo.
The PyDateTime_CAPI in cpython defines a number of operations to create the PyDateTime_* objects; however, it defines only the type for TZInfo and no methods to create these objects. The implementation of the api defines a very basic implementation of a timezone; however, this is not exposed through the API. Ultimately, in order to have proper operability on the timezone objects, there would need to be some C++ implementation of the TZInfo interface. The issue I see here is that the API code relies call_tzinfo_method which is making a call to a method assumed to be implemented on a derived python class as opposed to an implemented method on an interface. From what I can see here, there is no way to implement TZInfo objects in C++ which ultimately would make it impossible to properly bind timezone aware datetime objects. Is there some way around this or is this simply impossible in the current cpython implementation?