@@ -619,7 +619,8 @@ Export API
619619
620620.. c:struct:: PyLongLayout 
621621
622-    Layout of an array of digits, used by Python :class:`int` object. 
622+    Layout of an array of digits, used by Python :class:`int` object to 
623+    represent "big enough" integers. 
623624
624625   Use :c:func:`PyLong_GetNativeLayout` to get the native layout of Python 
625626   :class:`int` objects. 
@@ -641,7 +642,7 @@ Export API
641642      - ``1`` for most significant digit first 
642643      - ``-1`` for least significant digit first 
643644
644-    .. c:member:: int8_t endian  
645+    .. c:member:: int8_t endianness  
645646
646647      Digit endianness: 
647648
@@ -655,56 +656,60 @@ Export API
655656
656657   See the :c:struct:`PyLongLayout` structure. 
657658
659+    The function must not be called before Python initialization nor after 
660+    Python finalization. The returned layout is valid until Python is 
661+    finalized. The layout is the same for all Python sub-interpreters and 
662+    so it can be cached. 
658663
659- .. c:struct:: PyLongExport 
660664
661-    Export of a Python :class:`int` object. 
665+ .. c:type:: PyLongExport_Kind 
666+ 
667+     The enum value used to represent different results of 
668+     :c:func:`PyLong_Export`. 
669+ 
662670
663-    There are two cases: 
671+ .. c:struct:: PyLongExport 
664672
665-    * If :c:member:`digits` is ``NULL``, only use the :c:member:`value` member. 
666-      Calling :c:func:`PyLong_FreeExport` is optional in this case. 
667-    * If :c:member:`digits` is not ``NULL``, use :c:member:`negative`, 
668-      :c:member:`ndigits` and :c:member:`digits` members. 
669-      Calling :c:func:`PyLong_FreeExport` is mandatory in this case. 
673+    Export of a Python :class:`int` object. 
670674
671-    .. c:member :: int64_t value  
675+    .. c:struct :: digit_array  
672676
673-       The native integer value of the exported :class:`int` object. 
674-       Only valid if :c:member:`digits` is ``NULL``. 
677+       Export an integer as an array of digits; corresponds to 
678+       ``PyLongExport_DigitArray`` value of the enum  
679+       :c:type:`PyLongExport_Kind`. 
675680
676-    .. c:member:: uint8_t negative  
681+        .. c:member:: Py_ssize_t ndigits  
677682
678-       1 if the number is negative, 0 otherwise. 
679-       Only valid if :c:member:`digits` is not ``NULL``. 
683+          Number of digits in :c:member:`digits` array. 
680684
681-    .. c:member:: Py_ssize_t ndigits  
685+        .. c:member:: const   void  *digits  
682686
683-       Number of digits in :c:member:`digits` array. 
684-       Only valid if :c:member:`digits` is not ``NULL``. 
687+          Read-only array of unsigned  digits. 
685688
686-    .. c:member:: const  void *digits  
689+        .. c:member:: uint8_t  negative  
687690
688-       Read-only array of unsigned digits. Can be ``NULL`` . 
691+           1   if  the number is negative,  0  otherwise . 
689692
690693
691- .. c:function:: int  PyLong_Export(PyObject *obj, PyLongExport *export_long )  
694+  .. c :function :: PyLongExport_Kind  PyLong_Export (PyObject *obj, PyLongExport *export )  
692695
693696   Export a Python :class: `int ` object. 
694697
695-    On success, set *\* export_long * and return 0. 
696-    On error, set an exception and return -1. 
698+    On success, set *\* export * and return an appropriate export type 
699+    for the given value, see the :c:struct: `PyLongExport ` struct. 
700+    :c:func: `PyLong_FreeExport ` must be called when the export is no 
701+    longer needed.  Currently the only available type is 
702+    ``PyLongExport_DigitArray ``. 
703+ 
704+    On error, set an exception and return ``PyLongExport_Error ``. 
697705
698706   This function always succeeds if *obj * is a Python :class: `int ` object or a 
699707   subclass. 
700708
701-    If *export_long.digits * is not ``NULL ``, :c:func: `PyLong_FreeExport ` must be 
702-    called when the export is no longer needed. 
703- 
704709
705- .. c :function :: void  PyLong_FreeExport (PyLongExport *export_long )  
710+ .. c :function :: void  PyLong_FreeExport (PyLongExport *export )  
706711
707-    Release the export * export_long * created by :c:func: `PyLong_Export `. 
712+    Release the * export * created by :c:func: `PyLong_Export `. 
708713
709714
710715PyLongWriter API 
0 commit comments