Skip to content

Commit 8e9c767

Browse files
committed
Merge branch 'main' into gh-143866-pathlib-test
2 parents 2c25d40 + c461aa9 commit 8e9c767

167 files changed

Lines changed: 6664 additions & 3647 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ Tools/wasm/config.site-wasm32-emscripten @freakboy3742 @emmatyping
176176
Tools/wasm/emscripten @freakboy3742 @emmatyping
177177

178178
# WebAssembly (WASI)
179-
Tools/wasm/wasi-env @brettcannon @emmatyping
180-
Tools/wasm/wasi.py @brettcannon @emmatyping
181-
Tools/wasm/wasi @brettcannon @emmatyping
179+
Tools/wasm/wasi-env @brettcannon @emmatyping @savannahostrowski
180+
Tools/wasm/wasi.py @brettcannon @emmatyping @savannahostrowski
181+
Tools/wasm/wasi @brettcannon @emmatyping @savannahostrowski
182182

183183
# Windows
184184
PC/ @python/windows-team

Doc/c-api/file.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,22 @@ the :mod:`io` APIs instead.
131131
132132
Write string *s* to file object *p*. Return ``0`` on success or ``-1`` on
133133
failure; the appropriate exception will be set.
134+
135+
136+
Deprecated API
137+
^^^^^^^^^^^^^^
138+
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.
147+
148+
.. c:var:: PyTypeObject PyStdPrinter_Type
149+
150+
Type of file-like objects used internally at Python startup when :py:mod:`io` is
151+
not yet available.
152+
Use Python :py:func:`open` or :c:func:`PyFile_FromFd` to create file objects instead.

Doc/c-api/gen.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ than explicitly calling :c:func:`PyGen_New` or :c:func:`PyGen_NewWithQualName`.
4545
A reference to *frame* is stolen by this function. The *frame* argument
4646
must not be ``NULL``.
4747
48+
4849
.. c:function:: PyCodeObject* PyGen_GetCode(PyGenObject *gen)
4950
5051
Return a new :term:`strong reference` to the code object wrapped by *gen*.
@@ -82,3 +83,14 @@ Asynchronous Generator Objects
8283
This function always succeeds.
8384
8485
.. versionadded:: 3.6
86+
87+
88+
Deprecated API
89+
^^^^^^^^^^^^^^
90+
91+
.. c:macro:: PyAsyncGenASend_CheckExact(op)
92+
93+
This is a :term:`soft deprecated` API that was included in Python's C API
94+
by mistake.
95+
96+
It is solely here for completeness; do not use this API.

Doc/c-api/long.rst

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,8 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
453453
454454
Otherwise, returns the number of bytes required to store the value.
455455
If this is equal to or less than *n_bytes*, the entire value was copied.
456-
All *n_bytes* of the buffer are written: large buffers are padded with
457-
zeroes.
456+
All *n_bytes* of the buffer are written: remaining bytes filled by
457+
copies of the sign bit.
458458
459459
If the returned value is greater than *n_bytes*, the value was
460460
truncated: as many of the lowest bits of the value as could fit are written,
@@ -855,3 +855,31 @@ The :c:type:`PyLongWriter` API can be used to import an integer.
855855
If *writer* is ``NULL``, no operation is performed.
856856
857857
The writer instance and the *digits* array are invalid after the call.
858+
859+
860+
Deprecated API
861+
^^^^^^^^^^^^^^
862+
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:`PyLong_Export`
867+
to read integer data or :c:type:`PyLongWriter` to write it.
868+
These currently use the same layout, but are designed to continue working correctly
869+
even if CPython's internal integer representation changes.
870+
871+
872+
.. c:macro:: PyLong_SHIFT
873+
874+
This is equivalent to :c:member:`~PyLongLayout.bits_per_digit` in
875+
the output of :c:func:`PyLong_GetNativeLayout`.
876+
877+
878+
.. c:macro:: PyLong_BASE
879+
880+
This is currently equivalent to :c:expr:`1 << PyLong_SHIFT`.
881+
882+
883+
.. c:macro:: PyLong_MASK
884+
885+
This is currently equivalent to :c:expr:`(1 << PyLong_SHIFT) - 1`

Doc/c-api/memory.rst

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -293,17 +293,39 @@ The following type-oriented macros are provided for convenience. Note that
293293
294294
Same as :c:func:`PyMem_Free`.
295295
296-
In addition, the following macro sets are provided for calling the Python memory
297-
allocator directly, without involving the C API functions listed above. However,
298-
note that their use does not preserve binary compatibility across Python
299-
versions and is therefore deprecated in extension modules.
300-
301-
* ``PyMem_MALLOC(size)``
302-
* ``PyMem_NEW(type, size)``
303-
* ``PyMem_REALLOC(ptr, size)``
304-
* ``PyMem_RESIZE(ptr, type, size)``
305-
* ``PyMem_FREE(ptr)``
306-
* ``PyMem_DEL(ptr)``
296+
297+
Deprecated aliases
298+
------------------
299+
300+
These are :term:`soft deprecated` aliases to existing functions and macros.
301+
They exist solely for backwards compatibility.
302+
303+
.. list-table::
304+
:widths: auto
305+
:header-rows: 1
306+
307+
* * Deprecated alias
308+
* Corresponding function or macro
309+
* * .. c:macro:: PyMem_MALLOC(size)
310+
* :c:func:`PyMem_Malloc`
311+
* * .. c:macro:: PyMem_NEW(type, size)
312+
* :c:macro:`PyMem_New`
313+
* * .. c:macro:: PyMem_REALLOC(ptr, size)
314+
* :c:func:`PyMem_Realloc`
315+
* * .. c:macro:: PyMem_RESIZE(ptr, type, size)
316+
* :c:macro:`PyMem_Resize`
317+
* * .. c:macro:: PyMem_FREE(ptr)
318+
* :c:func:`PyMem_Free`
319+
* * .. c:macro:: PyMem_DEL(ptr)
320+
* :c:func:`PyMem_Free`
321+
322+
.. versionchanged:: 3.4
323+
324+
The macros are now aliases of the corresponding functions and macros.
325+
Previously, their behavior was the same, but their use did not necessarily
326+
preserve binary compatibility across Python versions.
327+
328+
.. deprecated:: 2.0
307329
308330
309331
.. _objectinterface:

Doc/c-api/set.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,20 @@ subtypes but not for instances of :class:`frozenset` or its subtypes.
166166
Empty an existing set of all elements. Return ``0`` on
167167
success. Return ``-1`` and raise :exc:`SystemError` if *set* is not an instance of
168168
:class:`set` or its subtype.
169+
170+
171+
Deprecated API
172+
^^^^^^^^^^^^^^
173+
174+
.. c:macro:: PySet_MINSIZE
175+
176+
A :term:`soft deprecated` constant representing the size of an internal
177+
preallocated table inside :c:type:`PySetObject` instances.
178+
179+
This is documented solely for completeness, as there are no guarantees
180+
that a given version of CPython uses preallocated tables with a fixed
181+
size.
182+
In code that does not deal with unstable set internals,
183+
:c:macro:`!PySet_MINSIZE` can be replaced with a small constant like ``8``.
184+
185+
If looking for the size of a set, use :c:func:`PySet_Size` instead.

Doc/library/base64.rst

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The :rfc:`4648` encodings are suitable for encoding binary data so that it can b
5151
safely sent by email, used as parts of URLs, or included as part of an HTTP
5252
POST request.
5353

54-
.. function:: b64encode(s, altchars=None)
54+
.. function:: b64encode(s, altchars=None, *, wrapcol=0)
5555

5656
Encode the :term:`bytes-like object` *s* using Base64 and return the encoded
5757
:class:`bytes`.
@@ -61,9 +61,16 @@ POST request.
6161
This allows an application to e.g. generate URL or filesystem safe Base64
6262
strings. The default is ``None``, for which the standard Base64 alphabet is used.
6363

64+
If *wrapcol* is non-zero, insert a newline (``b'\n'``) character
65+
after at most every *wrapcol* characters.
66+
If *wrapcol* is zero (default), do not insert any newlines.
67+
6468
May assert or raise a :exc:`ValueError` if the length of *altchars* is not 2. Raises a
6569
:exc:`TypeError` if *altchars* is not a :term:`bytes-like object`.
6670

71+
.. versionchanged:: 3.15
72+
Added the *wrapcol* parameter.
73+
6774

6875
.. function:: b64decode(s, altchars=None, validate=False)
6976

@@ -214,9 +221,9 @@ Refer to the documentation of the individual functions for more information.
214221
instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This
215222
feature is not supported by the "standard" Ascii85 encoding.
216223

217-
*wrapcol* controls whether the output should have newline (``b'\n'``)
218-
characters added to it. If this is non-zero, each output line will be
219-
at most this many characters long, excluding the trailing newline.
224+
If *wrapcol* is non-zero, insert a newline (``b'\n'``) character
225+
after at most every *wrapcol* characters.
226+
If *wrapcol* is zero (default), do not insert any newlines.
220227

221228
*pad* controls whether the input is padded to a multiple of 4
222229
before encoding. Note that the ``btoa`` implementation always pads.
@@ -278,7 +285,7 @@ Refer to the documentation of the individual functions for more information.
278285

279286
.. versionadded:: 3.13
280287

281-
.. versionchanged:: next
288+
.. versionchanged:: 3.15
282289
The *pad* parameter was added.
283290

284291

Doc/library/binascii.rst

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The :mod:`binascii` module defines the following functions:
5858

5959
Valid base64:
6060

61-
* Conforms to :rfc:`3548`.
61+
* Conforms to :rfc:`4648`.
6262
* Contains only characters from the base64 alphabet.
6363
* Contains no excess data after padding (including excess padding, newlines, etc.).
6464
* Does not start with a padding.
@@ -67,15 +67,24 @@ The :mod:`binascii` module defines the following functions:
6767
Added the *strict_mode* parameter.
6868

6969

70-
.. function:: b2a_base64(data, *, newline=True)
70+
.. function:: b2a_base64(data, *, wrapcol=0, newline=True)
7171

72-
Convert binary data to a line of ASCII characters in base64 coding. The return
73-
value is the converted line, including a newline char if *newline* is
74-
true. The output of this function conforms to :rfc:`3548`.
72+
Convert binary data to a line(s) of ASCII characters in base64 coding,
73+
as specified in :rfc:`4648`.
74+
75+
If *wrapcol* is non-zero, insert a newline (``b'\n'``) character
76+
after at most every *wrapcol* characters.
77+
If *wrapcol* is zero (default), do not insert any newlines.
78+
79+
If *newline* is true (default), a newline character will be added
80+
at the end of the output.
7581

7682
.. versionchanged:: 3.6
7783
Added the *newline* parameter.
7884

85+
.. versionchanged:: 3.15
86+
Added the *wrapcol* parameter.
87+
7988

8089
.. function:: a2b_qp(data, header=False)
8190

Doc/library/mmap.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
241241
specified alone, and the flush operation will extend from *offset*
242242
to the end of the mmap.
243243

244-
.. versionchanged:: next
244+
.. versionchanged:: 3.15
245245
Added *flags* parameter to control synchronization behavior.
246246

247247

@@ -488,4 +488,4 @@ MS_* Constants
488488
* :data:`MS_INVALIDATE` - Invalidate cached data: invalidates other mappings
489489
of the same file so they can see the changes.
490490

491-
.. versionadded:: next
491+
.. versionadded:: 3.15

Doc/library/os.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,7 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
15621562

15631563
.. availability:: Linux >= 6.11
15641564

1565-
.. versionadded:: next
1565+
.. versionadded:: 3.15
15661566

15671567

15681568
.. function:: ptsname(fd, /)

0 commit comments

Comments
 (0)