Skip to content

Commit bf1de26

Browse files
miss-islingtonAA-Turnerambv
authored andcommitted
[3.11] gh-93738: Disallow pre-v3 syntax in the C domain (GH-97962) (#97976)
Also, disable using invalid sphinx-lint 0.6.2. (cherry picked from commit f612565) Co-authored-by: Adam Turner <[email protected]> Co-authored-by: Łukasz Langa <[email protected]>
1 parent cc10a8e commit bf1de26

File tree

8 files changed

+18
-28
lines changed

8 files changed

+18
-28
lines changed

Doc/c-api/unicode.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ of Unicode characters while staying memory efficient. There are special cases
1717
for strings where all code points are below 128, 256, or 65536; otherwise, code
1818
points must be below 1114112 (which is the full Unicode range).
1919

20-
:c:type:`Py_UNICODE*` and UTF-8 representations are created on demand and cached
21-
in the Unicode object. The :c:type:`Py_UNICODE*` representation is deprecated
20+
:c:expr:`Py_UNICODE*` and UTF-8 representations are created on demand and cached
21+
in the Unicode object. The :c:expr:`Py_UNICODE*` representation is deprecated
2222
and inefficient.
2323

2424
Due to the transition between the old APIs and the new APIs, Unicode objects
@@ -30,7 +30,7 @@ can internally be in two states depending on how they were created:
3030

3131
* "legacy" Unicode objects have been created through one of the deprecated
3232
APIs (typically :c:func:`PyUnicode_FromUnicode`) and only bear the
33-
:c:type:`Py_UNICODE*` representation; you will have to call
33+
:c:expr:`Py_UNICODE*` representation; you will have to call
3434
:c:func:`PyUnicode_READY` on them before calling any other API.
3535

3636
.. note::
@@ -236,7 +236,7 @@ access to internal read-only data of Unicode objects:
236236
returned buffer is always terminated with an extra null code point. It
237237
may also contain embedded null code points, which would cause the string
238238
to be truncated when used in most C functions. The ``AS_DATA`` form
239-
casts the pointer to :c:type:`const char *`. The *o* argument has to be
239+
casts the pointer to :c:expr:`const char *`. The *o* argument has to be
240240
a Unicode object (not checked).
241241
242242
.. versionchanged:: 3.3
@@ -714,7 +714,7 @@ Extension modules can continue using them, as they will not be removed in Python
714714
715715
Return a read-only pointer to the Unicode object's internal
716716
:c:type:`Py_UNICODE` buffer, or ``NULL`` on error. This will create the
717-
:c:type:`Py_UNICODE*` representation of the object if it is not yet
717+
:c:expr:`Py_UNICODE*` representation of the object if it is not yet
718718
available. The buffer is always terminated with an extra null code point.
719719
Note that the resulting :c:type:`Py_UNICODE` string may also contain
720720
embedded null code points, which would cause the string to be truncated when
@@ -730,7 +730,7 @@ Extension modules can continue using them, as they will not be removed in Python
730730
731731
Like :c:func:`PyUnicode_AsUnicode`, but also saves the :c:func:`Py_UNICODE`
732732
array length (excluding the extra null terminator) in *size*.
733-
Note that the resulting :c:type:`Py_UNICODE*` string
733+
Note that the resulting :c:expr:`Py_UNICODE*` string
734734
may contain embedded null code points, which would cause the string to be
735735
truncated when used in most C functions.
736736

Doc/conf.py

-10
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,3 @@
234234
# Relative filename of the data files
235235
refcount_file = 'data/refcounts.dat'
236236
stable_abi_file = 'data/stable_abi.dat'
237-
238-
# Sphinx 2 and Sphinx 3 compatibility
239-
# -----------------------------------
240-
241-
# bpo-40204: Allow Sphinx 2 syntax in the C domain
242-
c_allow_pre_v3 = True
243-
244-
# bpo-40204: Disable warnings on Sphinx 2 syntax of the C domain since the
245-
# documentation is built with -W (warnings treated as errors).
246-
c_warn_on_allowed_pre_v3 = False

Doc/extending/newtypes.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ a special case, for which the new value passed to the handler is ``NULL``.
207207

208208
Python supports two pairs of attribute handlers; a type that supports attributes
209209
only needs to implement the functions for one pair. The difference is that one
210-
pair takes the name of the attribute as a :c:type:`char\*`, while the other
211-
accepts a :c:type:`PyObject\*`. Each type can use whichever pair makes more
210+
pair takes the name of the attribute as a :c:expr:`char\*`, while the other
211+
accepts a :c:expr:`PyObject*`. Each type can use whichever pair makes more
212212
sense for the implementation's convenience. ::
213213

214214
getattrfunc tp_getattr; /* char * version */
@@ -219,7 +219,7 @@ sense for the implementation's convenience. ::
219219

220220
If accessing attributes of an object is always a simple operation (this will be
221221
explained shortly), there are generic implementations which can be used to
222-
provide the :c:type:`PyObject\*` version of the attribute management functions.
222+
provide the :c:expr:`PyObject*` version of the attribute management functions.
223223
The actual need for type-specific attribute handlers almost completely
224224
disappeared starting with Python 2.2, though there are many examples which have
225225
not been updated to use some of the new generic mechanism that is available.
@@ -339,9 +339,9 @@ of ``NULL`` is required.
339339
Type-specific Attribute Management
340340
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
341341

342-
For simplicity, only the :c:type:`char\*` version will be demonstrated here; the
343-
type of the name parameter is the only difference between the :c:type:`char\*`
344-
and :c:type:`PyObject\*` flavors of the interface. This example effectively does
342+
For simplicity, only the :c:expr:`char\*` version will be demonstrated here; the
343+
type of the name parameter is the only difference between the :c:expr:`char\*`
344+
and :c:expr:`PyObject*` flavors of the interface. This example effectively does
345345
the same thing as the generic example above, but does not use the generic
346346
support added in Python 2.2. It explains how the handler functions are
347347
called, so that if you do need to extend their functionality, you'll understand
@@ -572,7 +572,7 @@ performance-critical objects (such as numbers).
572572

573573
For an object to be weakly referencable, the extension type must do two things:
574574

575-
#. Include a :c:type:`PyObject\*` field in the C object structure dedicated to
575+
#. Include a :c:expr:`PyObject*` field in the C object structure dedicated to
576576
the weak reference mechanism. The object's constructor should leave it
577577
``NULL`` (which is automatic when using the default
578578
:c:member:`~PyTypeObject.tp_alloc`).

Doc/extending/newtypes_tutorial.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The Basics
2424
==========
2525

2626
The :term:`CPython` runtime sees all Python objects as variables of type
27-
:c:type:`PyObject\*`, which serves as a "base type" for all Python objects.
27+
:c:expr:`PyObject*`, which serves as a "base type" for all Python objects.
2828
The :c:type:`PyObject` structure itself only contains the object's
2929
:term:`reference count` and a pointer to the object's "type object".
3030
This is where the action is; the type object determines which (C) functions

Doc/howto/isolating-extensions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ that subclass, which may be defined in different module than yours.
411411
pass
412412
413413
For a method to get its "defining class", it must use the
414-
:c:data:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS`
414+
:data:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS`
415415
:c:type:`calling convention <PyMethodDef>`
416416
and the corresponding :c:type:`PyCMethod` signature::
417417

Doc/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ blurb
1010
# sphinx-lint 0.6.2 yields many default role errors due to the new regular
1111
# expression used for default role detection, so we don't use the version
1212
# until the errors are fixed.
13-
sphinx-lint==0.6.1
13+
sphinx-lint<1,!=0.6.2
1414

1515
# The theme used by the documentation is stored separately, so we need
1616
# to install that as well.

Doc/whatsnew/2.2.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ code, none of the changes described here will affect you very much.
11021102
* A different argument parsing function, :c:func:`PyArg_UnpackTuple`, has been
11031103
added that's simpler and presumably faster. Instead of specifying a format
11041104
string, the caller simply gives the minimum and maximum number of arguments
1105-
expected, and a set of pointers to :c:type:`PyObject\*` variables that will be
1105+
expected, and a set of pointers to :c:expr:`PyObject*` variables that will be
11061106
filled in with argument values.
11071107

11081108
* Two new flags :const:`METH_NOARGS` and :const:`METH_O` are available in method

Doc/whatsnew/2.5.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,7 @@ attribute of the function object to change this::
17251725
``ctypes.pythonapi`` object. This object does *not* release the global
17261726
interpreter lock before calling a function, because the lock must be held when
17271727
calling into the interpreter's code. There's a :class:`py_object()` type
1728-
constructor that will create a :c:type:`PyObject \*` pointer. A simple usage::
1728+
constructor that will create a :c:expr:`PyObject *` pointer. A simple usage::
17291729

17301730
import ctypes
17311731

0 commit comments

Comments
 (0)