Skip to content

Commit e9bbf86

Browse files
Add a new Sphinx soft-deprecated directive (#148630)
Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent 2e37d83 commit e9bbf86

File tree

19 files changed

+155
-97
lines changed

19 files changed

+155
-97
lines changed

Doc/c-api/allocation.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
.. _allocating-objects:
44

5-
Allocating Objects on the Heap
5+
Allocating objects on the heap
66
==============================
77

88

@@ -153,18 +153,20 @@ Allocating Objects on the Heap
153153
To allocate and create extension modules.
154154

155155

156-
Deprecated aliases
157-
^^^^^^^^^^^^^^^^^^
156+
Soft-deprecated aliases
157+
^^^^^^^^^^^^^^^^^^^^^^^
158158

159-
These are :term:`soft deprecated` aliases to existing functions and macros.
159+
.. soft-deprecated:: 3.15
160+
161+
These are aliases to existing functions and macros.
160162
They exist solely for backwards compatibility.
161163

162164

163165
.. list-table::
164166
:widths: auto
165167
:header-rows: 1
166168

167-
* * Deprecated alias
169+
* * Soft-deprecated alias
168170
* Function
169171
* * .. c:macro:: PyObject_NEW(type, typeobj)
170172
* :c:macro:`PyObject_New`

Doc/c-api/bytes.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ 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.
50+
.. soft-deprecated:: 3.15
51+
Use the :c:type:`PyBytesWriter` API instead of
52+
``PyBytes_FromStringAndSize(NULL, len)``.
5353
5454
5555
.. c:function:: PyObject* PyBytes_FromFormat(const char *format, ...)
@@ -238,9 +238,8 @@ called with a non-bytes parameter.
238238
*\*bytes* is set to ``NULL``, :exc:`MemoryError` is set, and ``-1`` is
239239
returned.
240240
241-
.. deprecated:: 3.15
242-
The function is :term:`soft deprecated`,
243-
use the :c:type:`PyBytesWriter` API instead.
241+
.. soft-deprecated:: 3.15
242+
Use the :c:type:`PyBytesWriter` API instead.
244243
245244
246245
.. c:function:: PyObject *PyBytes_Repr(PyObject *bytes, int smartquotes)

Doc/c-api/extension-modules.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ the :c:data:`Py_mod_multiple_interpreters` slot.
191191
``PyInit`` function
192192
...................
193193

194-
.. deprecated:: 3.15
194+
.. soft-deprecated:: 3.15
195195

196-
This functionality is :term:`soft deprecated`.
197-
It will not get new features, but there are no plans to remove it.
196+
This functionality will not get new features,
197+
but there are no plans to remove it.
198198

199199
Instead of :c:func:`PyModExport_modulename`, an extension module can define
200200
an older-style :dfn:`initialization function` with the signature:
@@ -272,10 +272,9 @@ For example, a module called ``spam`` would be defined like this::
272272
Legacy single-phase initialization
273273
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
274274
275-
.. deprecated:: 3.15
275+
.. soft-deprecated:: 3.15
276276
277-
Single-phase initialization is :term:`soft deprecated`.
278-
It is a legacy mechanism to initialize extension
277+
Single-phase initialization is a legacy mechanism to initialize extension
279278
modules, with known drawbacks and design flaws. Extension module authors
280279
are encouraged to use multi-phase initialization instead.
281280

Doc/c-api/file.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
.. _fileobjects:
44

5-
File Objects
5+
File objects
66
------------
77

88
.. index:: pair: object; file
@@ -136,11 +136,12 @@ the :mod:`io` APIs instead.
136136
failure; the appropriate exception will be set.
137137
138138
139-
Deprecated API
140-
^^^^^^^^^^^^^^
139+
Soft-deprecated API
140+
^^^^^^^^^^^^^^^^^^^
141141
142+
.. soft-deprecated:: 3.15
142143
143-
These are :term:`soft deprecated` APIs that were included in Python's C API
144+
These are APIs that were included in Python's C API
144145
by mistake. They are documented solely for completeness; use other
145146
``PyFile*`` APIs instead.
146147

Doc/c-api/float.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ Floating-Point Objects
8686
It is equivalent to the :c:macro:`!INFINITY` macro from the C11 standard
8787
``<math.h>`` header.
8888
89-
.. deprecated:: 3.15
90-
The macro is :term:`soft deprecated`.
89+
.. soft-deprecated:: 3.15
9190
9291
9392
.. c:macro:: Py_NAN
@@ -103,8 +102,7 @@ Floating-Point Objects
103102
104103
Equivalent to :c:macro:`!INFINITY`.
105104
106-
.. deprecated:: 3.14
107-
The macro is :term:`soft deprecated`.
105+
.. soft-deprecated:: 3.14
108106
109107
110108
.. c:macro:: Py_MATH_E
@@ -161,26 +159,26 @@ Floating-Point Objects
161159
that is, it is normal, subnormal or zero, but not infinite or NaN.
162160
Return ``0`` otherwise.
163161
164-
.. deprecated:: 3.14
165-
The macro is :term:`soft deprecated`. Use :c:macro:`!isfinite` instead.
162+
.. soft-deprecated:: 3.14
163+
Use :c:macro:`!isfinite` instead.
166164
167165
168166
.. c:macro:: Py_IS_INFINITY(X)
169167
170168
Return ``1`` if the given floating-point number *X* is positive or negative
171169
infinity. Return ``0`` otherwise.
172170
173-
.. deprecated:: 3.14
174-
The macro is :term:`soft deprecated`. Use :c:macro:`!isinf` instead.
171+
.. soft-deprecated:: 3.14
172+
Use :c:macro:`!isinf` instead.
175173
176174
177175
.. c:macro:: Py_IS_NAN(X)
178176
179177
Return ``1`` if the given floating-point number *X* is a not-a-number (NaN)
180178
value. Return ``0`` otherwise.
181179
182-
.. deprecated:: 3.14
183-
The macro is :term:`soft deprecated`. Use :c:macro:`!isnan` instead.
180+
.. soft-deprecated:: 3.14
181+
Use :c:macro:`!isnan` instead.
184182
185183
186184
Pack and Unpack functions

Doc/c-api/frame.rst

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.. highlight:: c
22

3-
Frame Objects
3+
Frame objects
44
-------------
55

66
.. c:type:: PyFrameObject
@@ -147,7 +147,7 @@ See also :ref:`Reflection <reflection>`.
147147
Return the line number that *frame* is currently executing.
148148
149149
150-
Frame Locals Proxies
150+
Frame locals proxies
151151
^^^^^^^^^^^^^^^^^^^^
152152
153153
.. versionadded:: 3.13
@@ -169,7 +169,7 @@ See :pep:`667` for more information.
169169
Return non-zero if *obj* is a frame :func:`locals` proxy.
170170
171171
172-
Legacy Local Variable APIs
172+
Legacy local variable APIs
173173
^^^^^^^^^^^^^^^^^^^^^^^^^^
174174
175175
These APIs are :term:`soft deprecated`. As of Python 3.13, they do nothing.
@@ -178,48 +178,42 @@ They exist solely for backwards compatibility.
178178
179179
.. c:function:: void PyFrame_LocalsToFast(PyFrameObject *f, int clear)
180180
181-
This function is :term:`soft deprecated` and does nothing.
182-
183181
Prior to Python 3.13, this function would copy the :attr:`~frame.f_locals`
184182
attribute of *f* to the internal "fast" array of local variables, allowing
185183
changes in frame objects to be visible to the interpreter. If *clear* was
186184
true, this function would process variables that were unset in the locals
187185
dictionary.
188186
189-
.. versionchanged:: 3.13
187+
.. soft-deprecated:: 3.13
190188
This function now does nothing.
191189
192190
193191
.. c:function:: void PyFrame_FastToLocals(PyFrameObject *f)
194192
195-
This function is :term:`soft deprecated` and does nothing.
196-
197193
Prior to Python 3.13, this function would copy the internal "fast" array
198194
of local variables (which is used by the interpreter) to the
199195
:attr:`~frame.f_locals` attribute of *f*, allowing changes in local
200196
variables to be visible to frame objects.
201197
202-
.. versionchanged:: 3.13
198+
.. soft-deprecated:: 3.13
203199
This function now does nothing.
204200
205201
206202
.. c:function:: int PyFrame_FastToLocalsWithError(PyFrameObject *f)
207203
208-
This function is :term:`soft deprecated` and does nothing.
209-
210204
Prior to Python 3.13, this function was similar to
211205
:c:func:`PyFrame_FastToLocals`, but would return ``0`` on success, and
212206
``-1`` with an exception set on failure.
213207
214-
.. versionchanged:: 3.13
208+
.. soft-deprecated:: 3.13
215209
This function now does nothing.
216210
217211
218212
.. seealso::
219213
:pep:`667`
220214
221215
222-
Internal Frames
216+
Internal frames
223217
^^^^^^^^^^^^^^^
224218
225219
Unless using :pep:`523`, you will not need this.
@@ -249,5 +243,3 @@ Unless using :pep:`523`, you will not need this.
249243
Return the currently executing line number, or -1 if there is no line number.
250244
251245
.. versionadded:: 3.12
252-
253-

Doc/c-api/intro.rst

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -536,16 +536,14 @@ have been standardized in C11 (or previous standards).
536536

537537
Use the standard ``alignas`` specifier rather than this macro.
538538

539-
.. deprecated:: 3.15
540-
The macro is :term:`soft deprecated`.
539+
.. soft-deprecated:: 3.15
541540

542541
.. c:macro:: PY_FORMAT_SIZE_T
543542
544543
The :c:func:`printf` formatting modifier for :c:type:`size_t`.
545544
Use ``"z"`` directly instead.
546545

547-
.. deprecated:: 3.15
548-
The macro is :term:`soft deprecated`.
546+
.. soft-deprecated:: 3.15
549547

550548
.. c:macro:: Py_LL(number)
551549
Py_ULL(number)
@@ -558,8 +556,7 @@ have been standardized in C11 (or previous standards).
558556
559557
Consider using the C99 standard suffixes ``LL`` and ``LLU`` directly.
560558
561-
.. deprecated:: 3.15
562-
The macro is :term:`soft deprecated`.
559+
.. soft-deprecated:: 3.15
563560
564561
.. c:macro:: PY_LONG_LONG
565562
PY_INT32_T
@@ -572,8 +569,7 @@ have been standardized in C11 (or previous standards).
572569
respectively.
573570
Historically, these types needed compiler-specific extensions.
574571
575-
.. deprecated:: 3.15
576-
These macros are :term:`soft deprecated`.
572+
.. soft-deprecated:: 3.15
577573
578574
.. c:macro:: PY_LLONG_MIN
579575
PY_LLONG_MAX
@@ -587,16 +583,14 @@ have been standardized in C11 (or previous standards).
587583
The required header, ``<limits.h>``,
588584
:ref:`is included <capi-system-includes>` in ``Python.h``.
589585
590-
.. deprecated:: 3.15
591-
These macros are :term:`soft deprecated`.
586+
.. soft-deprecated:: 3.15
592587
593588
.. c:macro:: Py_MEMCPY(dest, src, n)
594589
595590
This is a :term:`soft deprecated` alias to :c:func:`!memcpy`.
596591
Use :c:func:`!memcpy` directly instead.
597592
598-
.. deprecated:: 3.14
599-
The macro is :term:`soft deprecated`.
593+
.. soft-deprecated:: 3.14
600594
601595
.. c:macro:: Py_UNICODE_SIZE
602596
@@ -606,16 +600,14 @@ have been standardized in C11 (or previous standards).
606600
The required header for the latter, ``<limits.h>``,
607601
:ref:`is included <capi-system-includes>` in ``Python.h``.
608602
609-
.. deprecated:: 3.15
610-
The macro is :term:`soft deprecated`.
603+
.. soft-deprecated:: 3.15
611604
612605
.. c:macro:: Py_UNICODE_WIDE
613606
614607
Defined if ``wchar_t`` can hold a Unicode character (UCS-4).
615608
Use ``sizeof(wchar_t) >= 4`` instead
616609
617-
.. deprecated:: 3.15
618-
The macro is :term:`soft deprecated`.
610+
.. soft-deprecated:: 3.15
619611
620612
.. c:macro:: Py_VA_COPY
621613
@@ -627,8 +619,7 @@ have been standardized in C11 (or previous standards).
627619
.. versionchanged:: 3.6
628620
This is now an alias to ``va_copy``.
629621
630-
.. deprecated:: 3.15
631-
The macro is :term:`soft deprecated`.
622+
.. soft-deprecated:: 3.15
632623
633624
634625
.. _api-objects:

Doc/c-api/long.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,10 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
197197
198198
.. c:function:: long PyLong_AS_LONG(PyObject *obj)
199199
200-
A :term:`soft deprecated` alias.
201200
Exactly equivalent to the preferred ``PyLong_AsLong``. In particular,
202201
it can fail with :exc:`OverflowError` or another exception.
203202
204-
.. deprecated:: 3.14
205-
The function is soft deprecated.
203+
.. soft-deprecated:: 3.14
206204
207205
.. c:function:: int PyLong_AsInt(PyObject *obj)
208206

Doc/c-api/module.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -965,9 +965,7 @@ or code that creates modules dynamically.
965965
// PyModule_AddObject() stole a reference to obj:
966966
// Py_XDECREF(obj) is not needed here.
967967
968-
.. deprecated:: 3.13
969-
970-
:c:func:`PyModule_AddObject` is :term:`soft deprecated`.
968+
.. soft-deprecated:: 3.13
971969
972970
973971
.. c:function:: int PyModule_AddIntConstant(PyObject *module, const char *name, long value)

Doc/c-api/monitoring.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,4 @@ would typically correspond to a Python function.
205205
206206
.. versionadded:: 3.13
207207
208-
.. deprecated:: 3.14
209-
210-
This function is :term:`soft deprecated`.
208+
.. soft-deprecated:: 3.14

0 commit comments

Comments
 (0)