Skip to content

Commit f612565

Browse files
authored
gh-93738: Disallow pre-v3 syntax in the C domain (#97962)
Also, disable using invalid sphinx-lint 0.6.2.
1 parent cd0fde2 commit f612565

File tree

7 files changed

+11
-33
lines changed

7 files changed

+11
-33
lines changed

Doc/conf.py

-25
Original file line numberDiff line numberDiff line change
@@ -239,28 +239,3 @@
239239
# Relative filename of the data files
240240
refcount_file = 'data/refcounts.dat'
241241
stable_abi_file = 'data/stable_abi.dat'
242-
243-
# Sphinx 2 and Sphinx 3 compatibility
244-
# -----------------------------------
245-
246-
# bpo-40204: Allow Sphinx 2 syntax in the C domain
247-
c_allow_pre_v3 = True
248-
249-
# bpo-40204: Disable warnings on Sphinx 2 syntax of the C domain since the
250-
# documentation is built with -W (warnings treated as errors).
251-
c_warn_on_allowed_pre_v3 = False
252-
253-
# Fix '!' not working with C domain when pre_v3 is enabled
254-
import sphinx
255-
256-
if sphinx.version_info[:2] < (5, 3):
257-
from sphinx.domains.c import CXRefRole
258-
259-
original_run = CXRefRole.run
260-
261-
def new_run(self):
262-
if self.disabled:
263-
return super(CXRefRole, self).run()
264-
return original_run(self)
265-
266-
CXRefRole.run = new_run

Doc/extending/newtypes.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ a special case, for which the new value passed to the handler is ``NULL``.
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
210210
pair takes the name of the attribute as a :c:expr:`char\*`, while the other
211-
accepts a :c:type:`PyObject\*`. Each type can use whichever pair makes more
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.
@@ -341,7 +341,7 @@ Type-specific Attribute Management
341341

342342
For simplicity, only the :c:expr:`char\*` version will be demonstrated here; the
343343
type of the name parameter is the only difference between the :c:expr:`char\*`
344-
and :c:type:`PyObject\*` flavors of the interface. This example effectively does
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

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ sphinx==4.5.0
77

88
blurb
99

10-
sphinx-lint<1
10+
# sphinx-lint 0.6.2 yields many default role errors due to the new regular
11+
# expression used for default role detection, so we don't use the version
12+
# until the errors are fixed.
13+
sphinx-lint<1,!=0.6.2
1114

1215
# The theme used by the documentation is stored separately, so we need
1316
# 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)