mirror of
https://github.com/python/cpython.git
synced 2026-01-22 07:08:40 +00:00
gh-141004: Document several soft-deprecated C APIs (GH-141634)
Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
a471a32f4b
commit
0e0d51cdce
5 changed files with 76 additions and 10 deletions
|
|
@ -131,3 +131,22 @@ the :mod:`io` APIs instead.
|
|||
|
||||
Write string *s* to file object *p*. Return ``0`` on success or ``-1`` on
|
||||
failure; the appropriate exception will be set.
|
||||
|
||||
|
||||
Deprecated API
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
These are :term:`soft deprecated` APIs that were included in Python's C API
|
||||
by mistake. They are documented solely for completeness; use other
|
||||
``PyFile*`` APIs instead.
|
||||
|
||||
.. c:function:: PyObject *PyFile_NewStdPrinter(int fd)
|
||||
|
||||
Use :c:func:`PyFile_FromFd` with defaults (``fd, NULL, "w", -1, NULL, NULL, NULL, 0``) instead.
|
||||
|
||||
.. c:var:: PyTypeObject PyStdPrinter_Type
|
||||
|
||||
Type of file-like objects used internally at Python startup when :py:mod:`io` is
|
||||
not yet available.
|
||||
Use Python :py:func:`open` or :c:func:`PyFile_FromFd` to create file objects instead.
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ than explicitly calling :c:func:`PyGen_New` or :c:func:`PyGen_NewWithQualName`.
|
|||
A reference to *frame* is stolen by this function. The *frame* argument
|
||||
must not be ``NULL``.
|
||||
|
||||
|
||||
.. c:function:: PyCodeObject* PyGen_GetCode(PyGenObject *gen)
|
||||
|
||||
Return a new :term:`strong reference` to the code object wrapped by *gen*.
|
||||
|
|
@ -82,3 +83,14 @@ Asynchronous Generator Objects
|
|||
This function always succeeds.
|
||||
|
||||
.. versionadded:: 3.6
|
||||
|
||||
|
||||
Deprecated API
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
.. c:macro:: PyAsyncGenASend_CheckExact(op)
|
||||
|
||||
This is a :term:`soft deprecated` API that was included in Python's C API
|
||||
by mistake.
|
||||
|
||||
It is solely here for completeness; do not use this API.
|
||||
|
|
|
|||
|
|
@ -855,3 +855,31 @@ The :c:type:`PyLongWriter` API can be used to import an integer.
|
|||
If *writer* is ``NULL``, no operation is performed.
|
||||
|
||||
The writer instance and the *digits* array are invalid after the call.
|
||||
|
||||
|
||||
Deprecated API
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
These macros are :term:`soft deprecated`. They describe parameters
|
||||
of the internal representation of :c:type:`PyLongObject` instances.
|
||||
|
||||
Use :c:func:`PyLong_GetNativeLayout` instead, along with :c:func:`PyLong_Export`
|
||||
to read integer data or :c:type:`PyLongWriter` to write it.
|
||||
These currently use the same layout, but are designed to continue working correctly
|
||||
even if CPython's internal integer representation changes.
|
||||
|
||||
|
||||
.. c:macro:: PyLong_SHIFT
|
||||
|
||||
This is equivalent to :c:member:`~PyLongLayout.bits_per_digit` in
|
||||
the output of :c:func:`PyLong_GetNativeLayout`.
|
||||
|
||||
|
||||
.. c:macro:: PyLong_BASE
|
||||
|
||||
This is currently equivalent to :c:expr:`1 << PyLong_SHIFT`.
|
||||
|
||||
|
||||
.. c:macro:: PyLong_MASK
|
||||
|
||||
This is currently equivalent to :c:expr:`(1 << PyLong_SHIFT) - 1`
|
||||
|
|
|
|||
|
|
@ -166,3 +166,20 @@ subtypes but not for instances of :class:`frozenset` or its subtypes.
|
|||
Empty an existing set of all elements. Return ``0`` on
|
||||
success. Return ``-1`` and raise :exc:`SystemError` if *set* is not an instance of
|
||||
:class:`set` or its subtype.
|
||||
|
||||
|
||||
Deprecated API
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
.. c:macro:: PySet_MINSIZE
|
||||
|
||||
A :term:`soft deprecated` constant representing the size of an internal
|
||||
preallocated table inside :c:type:`PySetObject` instances.
|
||||
|
||||
This is documented solely for completeness, as there are no guarantees
|
||||
that a given version of CPython uses preallocated tables with a fixed
|
||||
size.
|
||||
In code that does not deal with unstable set internals,
|
||||
:c:macro:`!PySet_MINSIZE` can be replaced with a small constant like ``8``.
|
||||
|
||||
If looking for the size of a set, use :c:func:`PySet_Size` instead.
|
||||
|
|
|
|||
|
|
@ -71,21 +71,11 @@ PyDescr_NAME
|
|||
PyDescr_TYPE
|
||||
PyWrapperFlag_KEYWORDS
|
||||
# cpython/fileobject.h
|
||||
PyFile_NewStdPrinter
|
||||
PyStdPrinter_Type
|
||||
Py_UniversalNewlineFgets
|
||||
# cpython/setobject.h
|
||||
PySet_MINSIZE
|
||||
# cpython/ceval.h
|
||||
PyUnstable_CopyPerfMapFile
|
||||
PyUnstable_PerfTrampoline_CompileCode
|
||||
PyUnstable_PerfTrampoline_SetPersistAfterFork
|
||||
# cpython/genobject.h
|
||||
PyAsyncGenASend_CheckExact
|
||||
# cpython/longintrepr.h
|
||||
PyLong_BASE
|
||||
PyLong_MASK
|
||||
PyLong_SHIFT
|
||||
# cpython/pyerrors.h
|
||||
PyException_HEAD
|
||||
# cpython/pyframe.h
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue