summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-07-21 07:52:07 (GMT)
committerGitHub <noreply@github.com>2023-07-21 07:52:07 (GMT)
commitfcc816dbff7ca66c26f57a506e4d2330fe41d0ff (patch)
tree98cc80573f16950153790ddbd7d017374d439d10 /Doc/whatsnew
parent81861fd90b4ae981e7881cd03a3c370713063525 (diff)
downloadcpython-fcc816dbff7ca66c26f57a506e4d2330fe41d0ff.zip
cpython-fcc816dbff7ca66c26f57a506e4d2330fe41d0ff.tar.gz
cpython-fcc816dbff7ca66c26f57a506e4d2330fe41d0ff.tar.bz2
gh-106919: Use role :c:macro: for referencing the C "constants" (GH-106920)
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r--Doc/whatsnew/2.2.rst6
-rw-r--r--Doc/whatsnew/2.3.rst8
-rw-r--r--Doc/whatsnew/2.4.rst2
-rw-r--r--Doc/whatsnew/2.6.rst6
-rw-r--r--Doc/whatsnew/2.7.rst2
-rw-r--r--Doc/whatsnew/3.10.rst10
-rw-r--r--Doc/whatsnew/3.11.rst4
-rw-r--r--Doc/whatsnew/3.12.rst24
-rw-r--r--Doc/whatsnew/3.13.rst4
-rw-r--r--Doc/whatsnew/3.6.rst10
-rw-r--r--Doc/whatsnew/3.8.rst2
-rw-r--r--Doc/whatsnew/3.9.rst2
12 files changed, 40 insertions, 40 deletions
diff --git a/Doc/whatsnew/2.2.rst b/Doc/whatsnew/2.2.rst
index 82aff0b..44e9bd8 100644
--- a/Doc/whatsnew/2.2.rst
+++ b/Doc/whatsnew/2.2.rst
@@ -1105,11 +1105,11 @@ code, none of the changes described here will affect you very much.
expected, and a set of pointers to :c:expr:`PyObject*` variables that will be
filled in with argument values.
-* Two new flags :const:`METH_NOARGS` and :const:`METH_O` are available in method
+* Two new flags :c:macro:`METH_NOARGS` and :c:macro:`METH_O` are available in method
definition tables to simplify implementation of methods with no arguments or a
single untyped argument. Calling such methods is more efficient than calling a
- corresponding method that uses :const:`METH_VARARGS`. Also, the old
- :const:`METH_OLDARGS` style of writing C methods is now officially deprecated.
+ corresponding method that uses :c:macro:`METH_VARARGS`. Also, the old
+ :c:macro:`METH_OLDARGS` style of writing C methods is now officially deprecated.
* Two new wrapper functions, :c:func:`PyOS_snprintf` and :c:func:`PyOS_vsnprintf`
were added to provide cross-platform implementations for the relatively new
diff --git a/Doc/whatsnew/2.3.rst b/Doc/whatsnew/2.3.rst
index 43bf3fa..c1722e5 100644
--- a/Doc/whatsnew/2.3.rst
+++ b/Doc/whatsnew/2.3.rst
@@ -1474,7 +1474,7 @@ complete list of changes, or look through the CVS logs for all the details.
* On Windows, the :mod:`socket` module now ships with Secure Sockets Layer
(SSL) support.
-* The value of the C :const:`PYTHON_API_VERSION` macro is now exposed at the
+* The value of the C :c:macro:`PYTHON_API_VERSION` macro is now exposed at the
Python level as ``sys.api_version``. The current exception can be cleared by
calling the new :func:`sys.exc_clear` function.
@@ -1899,10 +1899,10 @@ Changes to Python's build process and to the C API include:
* The :c:func:`PyArg_NoArgs` macro is now deprecated, and code that uses it
should be changed. For Python 2.2 and later, the method definition table can
- specify the :const:`METH_NOARGS` flag, signalling that there are no arguments,
+ specify the :c:macro:`METH_NOARGS` flag, signalling that there are no arguments,
and the argument checking can then be removed. If compatibility with pre-2.2
versions of Python is important, the code could use ``PyArg_ParseTuple(args,
- "")`` instead, but this will be slower than using :const:`METH_NOARGS`.
+ "")`` instead, but this will be slower than using :c:macro:`METH_NOARGS`.
* :c:func:`PyArg_ParseTuple` accepts new format characters for various sizes of
unsigned integers: ``B`` for :c:expr:`unsigned char`, ``H`` for :c:expr:`unsigned
@@ -1918,7 +1918,7 @@ Changes to Python's build process and to the C API include:
seconds, according to one measurement).
* It's now possible to define class and static methods for a C extension type by
- setting either the :const:`METH_CLASS` or :const:`METH_STATIC` flags in a
+ setting either the :c:macro:`METH_CLASS` or :c:macro:`METH_STATIC` flags in a
method's :c:type:`PyMethodDef` structure.
* Python now includes a copy of the Expat XML parser's source code, removing any
diff --git a/Doc/whatsnew/2.4.rst b/Doc/whatsnew/2.4.rst
index 43c3f01..ad46637 100644
--- a/Doc/whatsnew/2.4.rst
+++ b/Doc/whatsnew/2.4.rst
@@ -1476,7 +1476,7 @@ Some of the changes to Python's build process and to the C API are:
:c:func:`PyArg_ParseTupleAndKeywords` but takes a :c:type:`va_list` instead of a
number of arguments. (Contributed by Greg Chapman.)
-* A new method flag, :const:`METH_COEXISTS`, allows a function defined in slots
+* A new method flag, :c:macro:`METH_COEXISTS`, allows a function defined in slots
to co-exist with a :c:type:`PyCFunction` having the same name. This can halve
the access time for a method such as :meth:`set.__contains__`. (Contributed by
Raymond Hettinger.)
diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst
index 6917089..fb56690 100644
--- a/Doc/whatsnew/2.6.rst
+++ b/Doc/whatsnew/2.6.rst
@@ -1138,11 +1138,11 @@ indicate that the external caller is done.
The *flags* argument to :c:func:`PyObject_GetBuffer` specifies
constraints upon the memory returned. Some examples are:
- * :const:`PyBUF_WRITABLE` indicates that the memory must be writable.
+ * :c:macro:`PyBUF_WRITABLE` indicates that the memory must be writable.
- * :const:`PyBUF_LOCK` requests a read-only or exclusive lock on the memory.
+ * :c:macro:`PyBUF_LOCK` requests a read-only or exclusive lock on the memory.
- * :const:`PyBUF_C_CONTIGUOUS` and :const:`PyBUF_F_CONTIGUOUS`
+ * :c:macro:`PyBUF_C_CONTIGUOUS` and :c:macro:`PyBUF_F_CONTIGUOUS`
requests a C-contiguous (last dimension varies the fastest) or
Fortran-contiguous (first dimension varies the fastest) array layout.
diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst
index f8c7872..1cc6ebd 100644
--- a/Doc/whatsnew/2.7.rst
+++ b/Doc/whatsnew/2.7.rst
@@ -2231,7 +2231,7 @@ Changes to Python's build process and to the C API include:
* When using the :c:type:`PyMemberDef` structure to define attributes
of a type, Python will no longer let you try to delete or set a
- :const:`T_STRING_INPLACE` attribute.
+ :c:macro:`T_STRING_INPLACE` attribute.
.. rev 79644
diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
index ab030db..b65e73c 100644
--- a/Doc/whatsnew/3.10.rst
+++ b/Doc/whatsnew/3.10.rst
@@ -2124,11 +2124,11 @@ New Features
These functions allow to activate, deactivate and query the state of the garbage collector from C code without
having to import the :mod:`gc` module.
-* Add a new :c:data:`Py_TPFLAGS_DISALLOW_INSTANTIATION` type flag to disallow
+* Add a new :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` type flag to disallow
creating type instances.
(Contributed by Victor Stinner in :issue:`43916`.)
-* Add a new :c:data:`Py_TPFLAGS_IMMUTABLETYPE` type flag for creating immutable
+* Add a new :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` type flag for creating immutable
type objects: type attributes cannot be set nor deleted.
(Contributed by Victor Stinner and Erlend E. Aasland in :issue:`43908`.)
@@ -2187,9 +2187,9 @@ Porting to Python 3.10
been included directly, consider including ``Python.h`` instead.
(Contributed by Nicholas Sim in :issue:`35134`.)
-* Use the :c:data:`Py_TPFLAGS_IMMUTABLETYPE` type flag to create immutable type
- objects. Do not rely on :c:data:`Py_TPFLAGS_HEAPTYPE` to decide if a type
- object is mutable or not; check if :c:data:`Py_TPFLAGS_IMMUTABLETYPE` is set
+* Use the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` type flag to create immutable type
+ objects. Do not rely on :c:macro:`Py_TPFLAGS_HEAPTYPE` to decide if a type
+ object is mutable or not; check if :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` is set
instead.
(Contributed by Victor Stinner and Erlend E. Aasland in :issue:`43908`.)
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index 4519413..92e85fc 100644
--- a/Doc/whatsnew/3.11.rst
+++ b/Doc/whatsnew/3.11.rst
@@ -2347,11 +2347,11 @@ Porting to Python 3.11
#endif
* The :c:func:`PyType_Ready` function now raises an error if a type is defined
- with the :const:`Py_TPFLAGS_HAVE_GC` flag set but has no traverse function
+ with the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set but has no traverse function
(:c:member:`PyTypeObject.tp_traverse`).
(Contributed by Victor Stinner in :issue:`44263`.)
-* Heap types with the :const:`Py_TPFLAGS_IMMUTABLETYPE` flag can now inherit
+* Heap types with the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag can now inherit
the :pep:`590` vectorcall protocol. Previously, this was only possible for
:ref:`static types <static-types>`.
(Contributed by Erlend E. Aasland in :issue:`43908`)
diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst
index ab5e5b8..b3b9b41 100644
--- a/Doc/whatsnew/3.12.rst
+++ b/Doc/whatsnew/3.12.rst
@@ -1111,7 +1111,7 @@ Pending Removal in Python 3.14
* :class:`typing.ByteString`, deprecated since Python 3.9, now causes a
:exc:`DeprecationWarning` to be emitted when it is used.
-* Creating immutable types (:data:`Py_TPFLAGS_IMMUTABLETYPE`) with mutable
+* Creating immutable types (:c:macro:`Py_TPFLAGS_IMMUTABLETYPE`) with mutable
bases using the C API.
* Deprecated the *isdst* parameter in :func:`email.utils.localtime`.
@@ -1622,7 +1622,7 @@ New Features
inheriting or extending the base class size.
- :c:func:`PyObject_GetTypeData` and :c:func:`PyType_GetTypeDataSize`
added to allow access to subclass-specific instance data.
- - :const:`Py_TPFLAGS_ITEMS_AT_END` and :c:func:`PyObject_GetItemData`
+ - :c:macro:`Py_TPFLAGS_ITEMS_AT_END` and :c:func:`PyObject_GetItemData`
added to allow safely extending certain variable-sized types, including
:c:var:`PyType_Type`.
- :c:macro:`Py_RELATIVE_OFFSET` added to allow defining
@@ -1639,20 +1639,20 @@ New Features
:ref:`the vectorcall protocol <vectorcall>` was added to the
:ref:`Limited API <stable>`:
- * :const:`Py_TPFLAGS_HAVE_VECTORCALL`
+ * :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL`
* :c:func:`PyVectorcall_NARGS`
* :c:func:`PyVectorcall_Call`
* :c:type:`vectorcallfunc`
- The :const:`Py_TPFLAGS_HAVE_VECTORCALL` flag is now removed from a class
+ The :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is now removed from a class
when the class's :py:meth:`~object.__call__` method is reassigned.
This makes vectorcall safe to use with mutable types (i.e. heap types
- without the immutable flag, :const:`Py_TPFLAGS_IMMUTABLETYPE`).
+ without the immutable flag, :c:macro:`Py_TPFLAGS_IMMUTABLETYPE`).
Mutable types that do not override :c:member:`~PyTypeObject.tp_call` now
inherit the ``Py_TPFLAGS_HAVE_VECTORCALL`` flag.
(Contributed by Petr Viktorin in :gh:`93274`.)
- The :const:`Py_TPFLAGS_MANAGED_DICT` and :const:`Py_TPFLAGS_MANAGED_WEAKREF`
+ The :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF`
flags have been added. This allows extensions classes to support object
``__dict__`` and weakrefs with less bookkeeping,
using less memory and with faster access.
@@ -1663,7 +1663,7 @@ New Features
* :c:func:`PyObject_Vectorcall`
* :c:func:`PyObject_VectorcallMethod`
- * :const:`PY_VECTORCALL_ARGUMENTS_OFFSET`
+ * :c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`
This means that both the incoming and outgoing ends of the vector call
protocol are now available in the :ref:`Limited API <stable>`. (Contributed
@@ -1785,13 +1785,13 @@ Porting to Python 3.12
(Contributed by Philip Georgi in :gh:`95504`.)
* Extension classes wanting to add a ``__dict__`` or weak reference slot
- should use :const:`Py_TPFLAGS_MANAGED_DICT` and
- :const:`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and
+ should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and
+ :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and
``tp_weaklistoffset``, respectively.
The use of ``tp_dictoffset`` and ``tp_weaklistoffset`` is still
supported, but does not fully support multiple inheritance
(:gh:`95589`), and performance may be worse.
- Classes declaring :const:`Py_TPFLAGS_MANAGED_DICT` should call
+ Classes declaring :c:macro:`Py_TPFLAGS_MANAGED_DICT` should call
:c:func:`!_PyObject_VisitManagedDict` and :c:func:`!_PyObject_ClearManagedDict`
to traverse and clear their instance's dictionaries.
To clear weakrefs, call :c:func:`PyObject_ClearWeakRefs`, as before.
@@ -1845,7 +1845,7 @@ Porting to Python 3.12
:c:member:`~PyTypeObject.tp_init` instead.
- If the metaclass doesn't need to be instantiated from Python,
set its ``tp_new`` to ``NULL`` using
- the :const:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag.
+ the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag.
This makes it acceptable for ``PyType_From*`` functions.
- Avoid ``PyType_From*`` functions: if you don't need C-specific features
@@ -1896,7 +1896,7 @@ Deprecated
:c:type:`PyConfig` instead.
(Contributed by Victor Stinner in :gh:`77782`.)
-* Creating immutable types (:const:`Py_TPFLAGS_IMMUTABLETYPE`) with mutable
+* Creating immutable types (:c:macro:`Py_TPFLAGS_IMMUTABLETYPE`) with mutable
bases is deprecated and will be disabled in Python 3.14.
* The ``structmember.h`` header is deprecated, though it continues to be
diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst
index 479d08b..1d5e34d 100644
--- a/Doc/whatsnew/3.13.rst
+++ b/Doc/whatsnew/3.13.rst
@@ -961,7 +961,7 @@ Removed
Pending Removal in Python 3.14
------------------------------
-* Creating immutable types (:data:`Py_TPFLAGS_IMMUTABLETYPE`) with mutable
+* Creating immutable types (:c:macro:`Py_TPFLAGS_IMMUTABLETYPE`) with mutable
bases using the C API.
* Global configuration variables:
@@ -1017,7 +1017,7 @@ Pending Removal in Future Versions
The following APIs were deprecated in earlier Python versions and will be
removed, although there is currently no date scheduled for their removal.
-* :const:`Py_TPFLAGS_HAVE_FINALIZE`: no needed since Python 3.8.
+* :c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: no needed since Python 3.8.
* :c:func:`PyErr_Fetch`: use :c:func:`PyErr_GetRaisedException`.
* :c:func:`PyErr_NormalizeException`: use :c:func:`PyErr_GetRaisedException`.
* :c:func:`PyErr_Restore`: use :c:func:`PyErr_SetRaisedException`.
diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst
index 7d293c6..5161a02 100644
--- a/Doc/whatsnew/3.6.rst
+++ b/Doc/whatsnew/3.6.rst
@@ -650,8 +650,8 @@ compiled in release mode using ``PYTHONMALLOC=debug``. Effects of debug hooks:
* Detect writes before the start of a buffer (buffer underflows)
* Detect writes after the end of a buffer (buffer overflows)
* Check that the :term:`GIL <global interpreter lock>` is held when allocator
- functions of :c:data:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) and
- :c:data:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) domains are called.
+ functions of :c:macro:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) and
+ :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) domains are called.
Checking if the GIL is held is also a new feature of Python 3.6.
@@ -1822,7 +1822,7 @@ Optimizations
up to 80% faster. (Contributed by Josh Snider in :issue:`26574`).
* Allocator functions of the :c:func:`PyMem_Malloc` domain
- (:c:data:`PYMEM_DOMAIN_MEM`) now use the :ref:`pymalloc memory allocator
+ (:c:macro:`PYMEM_DOMAIN_MEM`) now use the :ref:`pymalloc memory allocator
<pymalloc>` instead of :c:func:`malloc` function of the C library. The
pymalloc allocator is optimized for objects smaller or equal to 512 bytes
with a short lifetime, and use :c:func:`malloc` for larger memory blocks.
@@ -1874,8 +1874,8 @@ Build and C API Changes
(Original patch by Alecsandru Patrascu of Intel in :issue:`26359`.)
* The :term:`GIL <global interpreter lock>` must now be held when allocator
- functions of :c:data:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) and
- :c:data:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) domains are called.
+ functions of :c:macro:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) and
+ :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) domains are called.
* New :c:func:`Py_FinalizeEx` API which indicates if flushing buffered data
failed.
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index 1676281..b27fcce 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -2116,7 +2116,7 @@ Changes in the C API
extension types across feature releases, anymore. A :c:type:`PyTypeObject`
exported by a third-party extension module is supposed to have all the
slots expected in the current Python version, including
- :c:member:`~PyTypeObject.tp_finalize` (:const:`Py_TPFLAGS_HAVE_FINALIZE`
+ :c:member:`~PyTypeObject.tp_finalize` (:c:macro:`Py_TPFLAGS_HAVE_FINALIZE`
is not checked anymore before reading :c:member:`~PyTypeObject.tp_finalize`).
(Contributed by Antoine Pitrou in :issue:`32388`.)
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst
index 976d72a..d1e7efa 100644
--- a/Doc/whatsnew/3.9.rst
+++ b/Doc/whatsnew/3.9.rst
@@ -1276,7 +1276,7 @@ New Features
* :pep:`573`: Added :c:func:`PyType_FromModuleAndSpec` to associate
a module with a class; :c:func:`PyType_GetModule` and
:c:func:`PyType_GetModuleState` to retrieve the module and its state; and
- :c:data:`PyCMethod` and :c:data:`METH_METHOD` to allow a method to
+ :c:data:`PyCMethod` and :c:macro:`METH_METHOD` to allow a method to
access the class it was defined in.
(Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.)