@@ -703,8 +703,8 @@ Export API
703703
704704   The function must not be called before Python initialization nor after 
705705   Python finalization. The returned layout is valid until Python is 
706-    finalized. The layout is the same for all Python sub-interpreters and  
707-    so it can be cached. 
706+    finalized. The layout is the same for all Python sub-interpreters 
707+    in a process, and  so it can be cached. 
708708
709709
710710.. c:struct:: PyLongExport 
@@ -714,10 +714,8 @@ Export API
714714   There are two cases: 
715715
716716   * If :c:member:`digits` is ``NULL``, only use the :c:member:`value` member. 
717-      Calling :c:func:`PyLong_FreeExport` is optional in this case. 
718717   * If :c:member:`digits` is not ``NULL``, use :c:member:`negative`, 
719718     :c:member:`ndigits` and :c:member:`digits` members. 
720-      Calling :c:func:`PyLong_FreeExport` is mandatory in this case. 
721719
722720   .. c:member:: int64_t value 
723721
@@ -743,20 +741,28 @@ Export API
743741
744742   Export a Python :class: `int ` object. 
745743
746-    *export_long * must not be ``NULL ``. 
744+    *export_long * must point to a :c:struct: `PyLongExport ` structure allocated 
745+    by the caller. It must not be ``NULL ``. 
747746
748-    On success, set  *\* export_long0 ``. 
747+    On success, fill in  *\* export_long0 ``. 
749748   On error, set an exception and return ``-1 ``. 
750749
751-    If *export_long->digits * is not ``NULL ``, :c:func: `PyLong_FreeExport ` must 
752-    be called when the export is no longer needed. Otherwise, calling 
753-    :c:func: `PyLong_FreeExport ` is optional. 
750+    :c:func: `PyLong_FreeExport ` must be called when the export is no longer 
751+    needed. 
752+ 
753+     .. impl-detail :: 
754+         This function always succeeds if *obj * is a Python :class: `int ` object 
755+         or a subclass. 
754756
755757
756758.. c :function :: void  PyLong_FreeExport (PyLongExport *export_long)   
757759
758760   Release the export *export_long * created by :c:func: `PyLong_Export `. 
759761
762+    .. impl-detail :: 
763+       Calling :c:func: `PyLong_FreeExport ` is optional if *export_long->digits * 
764+       is ``NULL ``. 
765+ 
760766
761767PyLongWriter API 
762768^^^^^^^^^^^^^^^^ 
@@ -787,12 +793,18 @@ The :c:type:`PyLongWriter` API can be used to import an integer.
787793
788794   *digits * must not be NULL. 
789795
790-    The caller can either initialize the array of digits *digits * and then 
791-    either call :c:func: `PyLongWriter_Finish ` to get a Python :class: `int ` or 
792-    :c:func: `PyLongWriter_Discard ` to destroy the writer instance.  Digits must 
793-    be in the range [``0 ``; ``(1 << bits_per_digit) - 1 ``]  (where the 
794-    :c:struct: `~PyLongLayout.bits_per_digit ` is the number of bits per digit). 
795-    The unused most significant digits must be set to ``0``. 
796+    After a successful call to this function, the caller should fill in the 
797+    array of digits *digits * and then call :c:func: `PyLongWriter_Finish ` to get 
798+    a Python :class: `int `. 
799+    The layout of *digits * is described by :c:func: `PyLong_GetNativeLayout `. 
800+ 
801+    Digits must be in the range [``0 ``; ``(1 << bits_per_digit) - 1 ``] 
802+    (where the :c:struct: `~PyLongLayout.bits_per_digit ` is the number of bits 
803+    per digit). 
804+    Any unused most significant digits must be set to ``0``. 
805+ 
806+    Alternately, call :c:func:`PyLongWriter_Discard` to destroy the writer 
807+    instance without creating an :class:`~int` object. 
796808
797809
798810.. c:function:: PyObject* PyLongWriter_Finish(PyLongWriter *writer)  
@@ -805,7 +817,7 @@ The :c:type:`PyLongWriter` API can be used to import an integer.
805817   The function takes care of normalizing the digits and converts the object 
806818   to a compact integer if needed. 
807819
808-    The writer instance is  invalid after the call. 
820+    The writer instance and the * digits * array are  invalid after the call. 
809821
810822
811823.. c :function :: void  PyLongWriter_Discard (PyLongWriter *writer)   
@@ -814,4 +826,4 @@ The :c:type:`PyLongWriter` API can be used to import an integer.
814826
815827   *writer * must not be ``NULL ``. 
816828
817-    The writer instance is  invalid after the call. 
829+    The writer instance and the * digits * array are  invalid after the call. 
0 commit comments