Skip to content

Commit 8dcf030

Browse files
committed
Merge branch 'main' into pybyteswriter_encode_utf8
2 parents 7181b30 + cf9ef73 commit 8dcf030

File tree

127 files changed

+2073
-770
lines changed

Some content is hidden

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

127 files changed

+2073
-770
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ Tools/patchcheck/ @AA-Turner
8282
# Autotools
8383
configure* @erlend-aasland @corona10 @AA-Turner @emmatyping
8484
Makefile.pre.in @erlend-aasland @AA-Turner @emmatyping
85+
Modules/makesetup @erlend-aasland @AA-Turner @emmatyping
8586
Modules/Setup* @erlend-aasland @AA-Turner @emmatyping
86-
Modules/makesetup @emmatyping
8787
Tools/build/regen-configure.sh @AA-Turner
8888

8989

Doc/c-api/bytes.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ called with a non-bytes parameter.
4747
*len* on success, and ``NULL`` on failure. If *v* is ``NULL``, the contents of
4848
the bytes object are uninitialized.
4949
50+
.. deprecated:: 3.15
51+
``PyBytes_FromStringAndSize(NULL, len)`` is :term:`soft deprecated`,
52+
use the :c:type:`PyBytesWriter` API instead.
53+
5054
5155
.. c:function:: PyObject* PyBytes_FromFormat(const char *format, ...)
5256
@@ -220,6 +224,12 @@ called with a non-bytes parameter.
220224
*\*bytes* is set to ``NULL``, :exc:`MemoryError` is set, and ``-1`` is
221225
returned.
222226
227+
.. deprecated:: 3.15
228+
The function is :term:`soft deprecated`,
229+
use the :c:type:`PyBytesWriter` API instead.
230+
231+
.. _pybyteswriter:
232+
223233
PyBytesWriter
224234
-------------
225235

Doc/c-api/init.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ The following functions can be safely called before Python is initialized:
4141
* :c:func:`PyObject_SetArenaAllocator`
4242
* :c:func:`Py_SetProgramName`
4343
* :c:func:`Py_SetPythonHome`
44-
* :c:func:`PySys_ResetWarnOptions`
4544
* the configuration functions covered in :ref:`init-config`
4645

4746
* Informative functions:
@@ -2011,6 +2010,11 @@ Reference tracing
20112010
is set to :c:data:`PyRefTracer_DESTROY`). The **data** argument is the opaque pointer
20122011
that was provided when :c:func:`PyRefTracer_SetTracer` was called.
20132012
2013+
If a new tracing function is registered replacing the current a call to the
2014+
trace function will be made with the object set to **NULL** and **event** set to
2015+
:c:data:`PyRefTracer_TRACKER_REMOVED`. This will happen just before the new
2016+
function is registered.
2017+
20142018
.. versionadded:: 3.13
20152019
20162020
.. c:var:: int PyRefTracer_CREATE
@@ -2023,6 +2027,13 @@ Reference tracing
20232027
The value for the *event* parameter to :c:type:`PyRefTracer` functions when a Python
20242028
object has been destroyed.
20252029
2030+
.. c:var:: int PyRefTracer_TRACKER_REMOVED
2031+
2032+
The value for the *event* parameter to :c:type:`PyRefTracer` functions when the
2033+
current tracer is about to be replaced by a new one.
2034+
2035+
.. versionadded:: 3.14
2036+
20262037
.. c:function:: int PyRefTracer_SetTracer(PyRefTracer tracer, void *data)
20272038
20282039
Register a reference tracer function. The function will be called when a new
@@ -2038,6 +2049,10 @@ Reference tracing
20382049
20392050
There must be an :term:`attached thread state` when calling this function.
20402051
2052+
If another tracer function was already registered, the old function will be
2053+
called with **event** set to :c:data:`PyRefTracer_TRACKER_REMOVED` just before
2054+
the new function is registered.
2055+
20412056
.. versionadded:: 3.13
20422057
20432058
.. c:function:: PyRefTracer PyRefTracer_GetTracer(void** data)

Doc/c-api/init_config.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,6 +1278,11 @@ PyConfig
12781278
12791279
Default: ``0``.
12801280
1281+
.. deprecated-removed:: 3.15 3.17
1282+
1283+
The :option:`-b` and :option:`!-bb` options will become no-op in 3.17.
1284+
:c:member:`~PyConfig.bytes_warning` member will be removed in 3.17.
1285+
12811286
.. c:member:: int warn_default_encoding
12821287
12831288
If non-zero, emit a :exc:`EncodingWarning` warning when :class:`io.TextIOWrapper`

Doc/c-api/sys.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,14 +316,6 @@ accessible to C code. They all work with the current interpreter thread's
316316
case *name* is deleted from the sys module. Returns ``0`` on success, ``-1``
317317
on error.
318318
319-
.. c:function:: void PySys_ResetWarnOptions()
320-
321-
Reset :data:`sys.warnoptions` to an empty list. This function may be
322-
called prior to :c:func:`Py_Initialize`.
323-
324-
.. deprecated-removed:: 3.13 3.15
325-
Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead.
326-
327319
.. c:function:: void PySys_WriteStdout(const char *format, ...)
328320
329321
Write the output string described by *format* to :data:`sys.stdout`. No

Doc/data/stable_abi.dat

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/deprecations/c-api-pending-removal-in-3.15.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Pending removal in Python 3.15
5959
Set :c:member:`PyConfig.program_name` instead.
6060
* :c:func:`!Py_SetPythonHome()`:
6161
Set :c:member:`PyConfig.home` instead.
62-
* :c:func:`PySys_ResetWarnOptions`:
62+
* :c:func:`!PySys_ResetWarnOptions`:
6363
Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead.
6464

6565
The :c:func:`Py_InitializeFromConfig` API should be used with

Doc/deprecations/pending-removal-in-3.14.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ Pending removal in Python 3.14
3838
is no current event loop set and it decides to create one.
3939
(Contributed by Serhiy Storchaka and Guido van Rossum in :gh:`100160`.)
4040

41-
* :mod:`collections.abc`: Deprecated :class:`!collections.abc.ByteString`.
42-
Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`.
43-
For use in typing, prefer a union, like ``bytes | bytearray``,
44-
or :class:`collections.abc.Buffer`.
45-
(Contributed by Shantanu Jain in :gh:`91896`.)
46-
4741
* :mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils.localtime`.
4842
(Contributed by Alan Williams in :gh:`72346`.)
4943

@@ -96,9 +90,6 @@ Pending removal in Python 3.14
9690
if :ref:`named placeholders <sqlite3-placeholders>` are used and
9791
*parameters* is a sequence instead of a :class:`dict`.
9892

99-
* :mod:`typing`: :class:`!typing.ByteString`, deprecated since Python 3.9,
100-
now causes a :exc:`DeprecationWarning` to be emitted when it is used.
101-
10293
* :mod:`urllib`:
10394
:class:`!urllib.parse.Quoter` is deprecated: it was not intended to be a
10495
public API.

Doc/deprecations/pending-removal-in-3.17.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,15 @@ Pending removal in Python 3.17
88
but it has been retained for backward compatibility, with removal scheduled for Python
99
3.17. Users should use documented introspection helpers like :func:`typing.get_origin`
1010
and :func:`typing.get_args` instead of relying on private implementation details.
11+
- :class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for removal in
12+
Python 3.17. Prefer :class:`~collections.abc.Sequence` or
13+
:class:`~collections.abc.Buffer`. For use in type annotations, prefer a union, like
14+
``bytes | bytearray``, or :class:`collections.abc.Buffer`.
15+
(Contributed by Shantanu Jain in :gh:`91896`.)
16+
17+
* :mod:`collections.abc`:
18+
19+
- :class:`collections.abc.ByteString` is scheduled for removal in Python 3.17. Prefer
20+
:class:`~collections.abc.Sequence` or :class:`~collections.abc.Buffer`. For use in
21+
type annotations, prefer a union, like ``bytes | bytearray``, or
22+
:class:`collections.abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)

Doc/library/collections.abc.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ ABC Inherits from Abstract Methods Mi
140140
``__len__``,
141141
``insert``
142142

143+
:class:`ByteString` :class:`Sequence` ``__getitem__``, Inherited :class:`Sequence` methods
144+
``__len__``
145+
143146
:class:`Set` :class:`Collection` ``__contains__``, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``,
144147
``__iter__``, ``__gt__``, ``__ge__``, ``__and__``, ``__or__``,
145148
``__len__`` ``__sub__``, ``__rsub__``, ``__xor__``, ``__rxor__``
@@ -260,6 +263,7 @@ Collections Abstract Base Classes -- Detailed Descriptions
260263

261264
.. class:: Sequence
262265
MutableSequence
266+
ByteString
263267

264268
ABCs for read-only and mutable :term:`sequences <sequence>`.
265269

@@ -285,6 +289,12 @@ Collections Abstract Base Classes -- Detailed Descriptions
285289
The :meth:`~sequence.index` method gained support for
286290
the *stop* and *start* arguments.
287291

292+
.. deprecated-removed:: 3.12 3.17
293+
The :class:`ByteString` ABC has been deprecated.
294+
For use in type annotations, prefer a union, like ``bytes | bytearray``, or
295+
:class:`collections.abc.Buffer`.
296+
For use as an ABC, prefer :class:`Sequence` or :class:`collections.abc.Buffer`.
297+
288298
.. class:: Set
289299
MutableSet
290300

0 commit comments

Comments
 (0)