Skip to content

Commit 4012185

Browse files
authored
Merge branch '3.14' into gh-158973-reset-warnings-lock-3.14
2 parents 1ff80c7 + f14744f commit 4012185

5 files changed

Lines changed: 41 additions & 11 deletions

File tree

‎Doc/c-api/file.rst‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,29 @@ the :mod:`io` APIs instead.
6060
raised if the end of the file is reached immediately.
6161
6262
63+
.. c:function:: char* Py_UniversalNewlineFgets(char *buf, int n, FILE *stream, PyObject *fobj)
64+
65+
Read a line from the C stream *stream* into the buffer *buf*, like the
66+
C standard library function :c:func:`!fgets`, but treating all of ``\n``,
67+
``\r`` and ``\r\n`` as line endings (see :term:`universal newlines`).
68+
Any ``\r`` or ``\r\n`` read from the stream is stored in *buf* as a
69+
single ``\n``.
70+
71+
At most ``n - 1`` characters are stored in *buf*; reading stops after a
72+
newline has been stored or when the end of the file is reached.
73+
The result is always null-terminated.
74+
*stream* should be opened in binary mode, so that the C library does not
75+
perform its own newline translation.
76+
77+
Return *buf* on success.
78+
Return ``NULL`` if no characters could be read, because *stream* is at
79+
end of file, a read error occurred, or *n* is less than 2.
80+
Like :c:func:`!fgets`, this function does not distinguish between end of
81+
file and a read error, and it does not set an exception.
82+
83+
*fobj* exists only for backward compatibility and must be ``NULL``.
84+
85+
6386
.. c:function:: int PyFile_SetOpenCodeHook(Py_OpenCodeHookFunction handler)
6487
6588
Overrides the normal behavior of :func:`io.open_code` to pass its parameter

‎Doc/c-api/float.rst‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ Pack functions
210210
The pack routines write 2, 4 or 8 bytes, starting at *p*. *le* is an
211211
:c:expr:`int` argument, non-zero if you want the bytes string in little-endian
212212
format (exponent last, at ``p+1``, ``p+3``, or ``p+6`` and ``p+7``), zero if you
213-
want big-endian format (exponent first, at *p*). The :c:macro:`PY_BIG_ENDIAN`
214-
constant can be used to use the native endian: it is equal to ``1`` on big
215-
endian processor, or ``0`` on little endian processor.
213+
want big-endian format (exponent first, at *p*). Use the :c:macro:`PY_LITTLE_ENDIAN`
214+
constant to select the native endian: it is equal to ``0`` on big
215+
endian processor, or ``1`` on little endian processor.
216216
217217
Return value: ``0`` if all is OK, ``-1`` if error (and an exception is set,
218218
most likely :exc:`OverflowError`).
@@ -241,8 +241,8 @@ Unpack functions
241241
The unpack routines read 2, 4 or 8 bytes, starting at *p*. *le* is an
242242
:c:expr:`int` argument, non-zero if the bytes string is in little-endian format
243243
(exponent last, at ``p+1``, ``p+3`` or ``p+6`` and ``p+7``), zero if big-endian
244-
(exponent first, at *p*). The :c:macro:`PY_BIG_ENDIAN` constant can be used to
245-
use the native endian: it is equal to ``1`` on big endian processor, or ``0``
244+
(exponent first, at *p*). Use the :c:macro:`PY_LITTLE_ENDIAN` constant to
245+
select the native endian: it is equal to ``0`` on big endian processor, or ``1``
246246
on little endian processor.
247247
248248
Return value: The unpacked double. On error, this is ``-1.0`` and

‎Doc/c-api/intro.rst‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,12 @@ Numeric utilities
259259
Argument must be a character or an integer in the range [-128, 127] or [0,
260260
255]. This macro returns ``c`` cast to an ``unsigned char``.
261261

262+
.. c:macro:: PY_BIG_ENDIAN
263+
PY_LITTLE_ENDIAN
264+
265+
Constants describing the byte order of the platform that Python was built
266+
for. Exactly one of them is ``1`` and the other is ``0``.
267+
262268

263269
Assertion utilities
264270
^^^^^^^^^^^^^^^^^^^
@@ -820,8 +826,13 @@ use them.
820826
821827
A signed integral type such that ``sizeof(Py_ssize_t) == sizeof(size_t)``.
822828
C99 doesn't define such a thing directly (size_t is an unsigned integral type).
823-
See :pep:`353` for details. ``PY_SSIZE_T_MAX`` is the largest positive value
824-
of type :c:type:`Py_ssize_t`.
829+
See :pep:`353` for details.
830+
831+
.. c:macro:: PY_SSIZE_T_MAX
832+
PY_SSIZE_T_MIN
833+
834+
The limit values (largest positive one and smallest negative one,
835+
respecitvely) of type :c:type:`Py_ssize_t`.
825836

826837

827838
.. _api-exceptions:

‎Doc/tools/.nitignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# as tested on the CI via check-warnings.py in reusable-docs.yml.
33
# Keep lines sorted lexicographically to help avoid merge conflicts.
44

5-
Doc/c-api/float.rst
65
Doc/c-api/module.rst
76
Doc/library/ast.rst
87
Doc/library/asyncio-extending.rst

‎Tools/check-c-api-docs/ignored_c_api.txt‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ PY_DWORD_MAX
3131
PY_FORMAT_SIZE_T
3232
PY_INT32_T
3333
PY_INT64_T
34-
PY_LITTLE_ENDIAN
3534
PY_LLONG_MAX
3635
PY_LLONG_MIN
3736
PY_LONG_LONG
@@ -56,8 +55,6 @@ PyDescr_COMMON
5655
PyDescr_NAME
5756
PyDescr_TYPE
5857
PyWrapperFlag_KEYWORDS
59-
# cpython/fileobject.h
60-
Py_UniversalNewlineFgets
6158
# cpython/pylifecycle.h
6259
Py_FrozenMain
6360
# cpython/objimpl.h

0 commit comments

Comments
 (0)