[Python-Dev] limited_api and datetime

Christian Tismer tismer at stackless.com
Wed Aug 23 02:31:59 EDT 2017

Hi Nick,

On 23.08.17 07:41, Nick Coghlan wrote:
> On 23 August 2017 at 00:09, stackless <tismer at stackless.com> wrote:
>> Hi again,
>> I am trying to support the limited Api (PEP 384) for PySide. Fortunately,
>> everything worked out of the box, just the datetime module gives me
>> a problem. Inspection showed that datetime is completely removed
>> when the limitation is set.
>> Can somebody enlighten me why that needs to be so?
> The main problem is that "datetime.h" defines several C structs that
> we wouldn't want to add to the stable ABI, and nobody has previously
> worked through details of the interface to see which parts of it could
> still be used even if those structs were made opaque, and the macros
> relying on them were switched to being functions instead.
> There are almost certainly pieces of it that *could* be usefully
> exposed, though.
>> And how should I use datetime, instead: Fish the functions out of
>> the dynamically imported datetime module?
> Yep, going via the Python level API rather than directly to the C API
> is the default answer, as that inherently hides any struct layout
> details behind PyObject*.

Thank you very much for the clarification.
I think we can live with the Python interface for now.
Now I'm sure that I'm going the way to go.

Cheers -- Chris

Christian Tismer             :^)   tismer at stackless.com
Software Consulting          :     http://www.stackless.com/
Karl-Liebknecht-Str. 121     :     https://github.com/PySide
14482 Potsdam                :     GPG key -> 0xFB7BEE0E
phone +49 173 24 18 776  fax +49 (30) 700143-0023

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-dev/attachments/20170823/7ec25ede/attachment.sig>

More information about the Python-Dev mailing list