Skip to content

Commit 8bcf20b

Browse files
Apply suggestions from code review
Co-authored-by: Petr Viktorin <encukou@gmail.com>
1 parent df5566c commit 8bcf20b

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

Doc/c-api/file.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,17 @@ the :mod:`io` APIs instead.
136136
Deprecated API
137137
^^^^^^^^^^^^^^
138138
139-
.. c:function:: PyObject *PyFile_NewStdPrinter(void)
139+
140+
These are :term:`soft deprecated` APIs that were included in Python's C API
141+
by mistake. They are documented solely for completeness; use other
142+
``PyFile*`` APIs instead.
143+
144+
.. c:function:: PyObject *PyFile_NewStdPrinter(int fd)
145+
146+
Use :c:func:`PyFile_FromFd` with defaults (``fd, NULL, "w", -1, NULL, NULL, NULL, 0``) instead.
140147
141148
.. c:var:: PyTypeObject PyStdPrinter_Type
142149
143-
These are :term:`soft deprecated` APIs that were included in Python's C API
144-
by mistake. They are documented solely for completeness; use other
145-
``PyFile*`` APIs instead.
150+
Type of file-like objects used internally at Python startup when :py:mod:`io` is
151+
not yet available.
152+
Use :py:func:`io.open` or :c:func:`PyFile_FromFd` to create file objects instead.

Doc/c-api/long.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -860,14 +860,19 @@ The :c:type:`PyLongWriter` API can be used to import an integer.
860860
Deprecated API
861861
^^^^^^^^^^^^^^
862862
863-
These macros are :term:`soft deprecated`. They represent internal constants
864-
for :c:type:`PyLongObject` instances.
863+
These macros are :term:`soft deprecated`. They describe parameters
864+
of the internal representation of :c:type:`PyLongObject` instances.
865+
866+
Use :c:func:`PyLong_GetNativeLayout` instead, along with :c:func:`PyLongExport` and
867+
:c:type:`PyLongWriter` to access integer data.
868+
These currently use the same layout, but are designed to continue working correctly
869+
even if CPython's internal integer representation changes.
865870
866-
Do not use these; use :c:func:`PyLong_GetNativeLayout` instead.
867871
868872
.. c:macro:: PyLong_SHIFT
869873
870-
This is currently equivalent to ``30``.
874+
This is equivalent to :c:member:`~PyLongLayout.bits_per_digit` in
875+
the output of :c:func:`PyLong_GetNativeLayout`.
871876
872877
873878
.. c:macro:: PyLong_BASE
@@ -877,4 +882,4 @@ Do not use these; use :c:func:`PyLong_GetNativeLayout` instead.
877882
878883
.. c:macro:: PyLong_MASK
879884
880-
This is currently equivalent to :c:expr:`PyLong_BASE - 1`
885+
This is currently equivalent to :c:expr:`(1 << PyLong_SHIFT) - 1`

0 commit comments

Comments
 (0)