Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b20525f

Browse files
Merge branch 'main' into sqlite-remove-deprecated-features
2 parents ef7a0ec + fa2b8b7 commit b20525f

222 files changed

Lines changed: 2047 additions & 3336 deletions

File tree

Some content is hidden

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

.github/workflows/doc.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ jobs:
4343
# Run "check doctest html" as 3 steps to get a more readable output
4444
# in the web UI
4545
- name: 'Check documentation'
46-
run: make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W --keep-going -j4" check
46+
run: make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W --keep-going" check
4747
# Use "xvfb-run" since some doctest tests open GUI windows
4848
- name: 'Run documentation doctest'
49-
run: xvfb-run make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W --keep-going -j4" doctest
49+
run: xvfb-run make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W --keep-going" doctest
5050
- name: 'Build HTML documentation'
51-
run: make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W --keep-going -j4" html
51+
run: make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W --keep-going" html
5252
- name: 'Upload'
5353
uses: actions/upload-artifact@v3
5454
with:

Doc/Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ SPHINXERRORHANDLING = -W
1818
PAPEROPT_a4 = -D latex_elements.papersize=a4paper
1919
PAPEROPT_letter = -D latex_elements.papersize=letterpaper
2020

21-
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees $(PAPEROPT_$(PAPER)) \
21+
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees $(PAPEROPT_$(PAPER)) -j auto \
2222
$(SPHINXOPTS) $(SPHINXERRORHANDLING) . build/$(BUILDER) $(SOURCES)
2323

2424
.PHONY: help build html htmlhelp latex text texinfo changes linkcheck \
@@ -213,8 +213,10 @@ dist:
213213
rm dist/python-$(DISTVERSION)-docs-texinfo.tar
214214

215215
check:
216-
$(SPHINXLINT) -i tools -i $(VENVDIR) -i README.rst
217-
$(SPHINXLINT) ../Misc/NEWS.d/next/
216+
# Check the docs and NEWS files with sphinx-lint.
217+
# Ignore the tools and venv dirs and check that the default role is not used.
218+
$(SPHINXLINT) -i tools -i $(VENVDIR) --enable default-role
219+
$(SPHINXLINT) --enable default-role ../Misc/NEWS.d/next/
218220

219221
serve:
220222
@echo "The serve target was removed, use htmlview instead (see bpo-36329)"

Doc/c-api/arg.rst

Lines changed: 7 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -136,48 +136,6 @@ which disallows mutable objects such as :class:`bytearray`.
136136
attempting any conversion. Raises :exc:`TypeError` if the object is not
137137
a :class:`bytearray` object. The C variable may also be declared as :c:type:`PyObject*`.
138138

139-
``u`` (:class:`str`) [const Py_UNICODE \*]
140-
Convert a Python Unicode object to a C pointer to a NUL-terminated buffer of
141-
Unicode characters. You must pass the address of a :c:type:`Py_UNICODE`
142-
pointer variable, which will be filled with the pointer to an existing
143-
Unicode buffer. Please note that the width of a :c:type:`Py_UNICODE`
144-
character depends on compilation options (it is either 16 or 32 bits).
145-
The Python string must not contain embedded null code points; if it does,
146-
a :exc:`ValueError` exception is raised.
147-
148-
.. versionchanged:: 3.5
149-
Previously, :exc:`TypeError` was raised when embedded null code points
150-
were encountered in the Python string.
151-
152-
.. deprecated-removed:: 3.3 3.12
153-
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
154-
:c:func:`PyUnicode_AsWideCharString`.
155-
156-
``u#`` (:class:`str`) [const Py_UNICODE \*, :c:type:`Py_ssize_t`]
157-
This variant on ``u`` stores into two C variables, the first one a pointer to a
158-
Unicode data buffer, the second one its length. This variant allows
159-
null code points.
160-
161-
.. deprecated-removed:: 3.3 3.12
162-
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
163-
:c:func:`PyUnicode_AsWideCharString`.
164-
165-
``Z`` (:class:`str` or ``None``) [const Py_UNICODE \*]
166-
Like ``u``, but the Python object may also be ``None``, in which case the
167-
:c:type:`Py_UNICODE` pointer is set to ``NULL``.
168-
169-
.. deprecated-removed:: 3.3 3.12
170-
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
171-
:c:func:`PyUnicode_AsWideCharString`.
172-
173-
``Z#`` (:class:`str` or ``None``) [const Py_UNICODE \*, :c:type:`Py_ssize_t`]
174-
Like ``u#``, but the Python object may also be ``None``, in which case the
175-
:c:type:`Py_UNICODE` pointer is set to ``NULL``.
176-
177-
.. deprecated-removed:: 3.3 3.12
178-
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
179-
:c:func:`PyUnicode_AsWideCharString`.
180-
181139
``U`` (:class:`str`) [PyObject \*]
182140
Requires that the Python object is a Unicode object, without attempting
183141
any conversion. Raises :exc:`TypeError` if the object is not a Unicode
@@ -247,6 +205,11 @@ which disallows mutable objects such as :class:`bytearray`.
247205
them. Instead, the implementation assumes that the byte string object uses the
248206
encoding passed in as parameter.
249207

208+
.. versionchanged:: 3.12
209+
``u``, ``u#``, ``Z``, and ``Z#`` are removed because they used a legacy
210+
``Py_UNICODE*`` representation.
211+
212+
250213
Numbers
251214
-------
252215

@@ -286,7 +249,7 @@ Numbers
286249
Convert a Python integer to a C :c:type:`unsigned long long`
287250
without overflow checking.
288251

289-
``n`` (:class:`int`) [Py_ssize_t]
252+
``n`` (:class:`int`) [:c:type:`Py_ssize_t`]
290253
Convert a Python integer to a C :c:type:`Py_ssize_t`.
291254

292255
``c`` (:class:`bytes` or :class:`bytearray` of length 1) [char]
@@ -613,7 +576,7 @@ Building values
613576
``K`` (:class:`int`) [unsigned long long]
614577
Convert a C :c:type:`unsigned long long` to a Python integer object.
615578
616-
``n`` (:class:`int`) [Py_ssize_t]
579+
``n`` (:class:`int`) [:c:type:`Py_ssize_t`]
617580
Convert a C :c:type:`Py_ssize_t` to a Python integer.
618581
619582
``c`` (:class:`bytes` of length 1) [char]

Doc/c-api/bytes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ called with a non-bytes parameter.
8484
| :attr:`%lu` | unsigned long | Equivalent to |
8585
| | | ``printf("%lu")``. [1]_ |
8686
+-------------------+---------------+--------------------------------+
87-
| :attr:`%zd` | Py_ssize_t | Equivalent to |
88-
| | | ``printf("%zd")``. [1]_ |
87+
| :attr:`%zd` | :c:type:`\ | Equivalent to |
88+
| | Py_ssize_t` | ``printf("%zd")``. [1]_ |
8989
+-------------------+---------------+--------------------------------+
9090
| :attr:`%zu` | size_t | Equivalent to |
9191
| | | ``printf("%zu")``. [1]_ |

Doc/c-api/init_config.rst

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ PyWideStringList
9797
If *index* is greater than or equal to *list* length, append *item* to
9898
*list*.
9999
100-
*index* must be greater than or equal to 0.
100+
*index* must be greater than or equal to ``0``.
101101
102102
Python must be preinitialized to call this function.
103103
@@ -256,18 +256,18 @@ PyPreConfig
256256
257257
Set the LC_CTYPE locale to the user preferred locale?
258258
259-
If equals to 0, set :c:member:`~PyPreConfig.coerce_c_locale` and
260-
:c:member:`~PyPreConfig.coerce_c_locale_warn` members to 0.
259+
If equals to ``0``, set :c:member:`~PyPreConfig.coerce_c_locale` and
260+
:c:member:`~PyPreConfig.coerce_c_locale_warn` members to ``0``.
261261
262262
See the :term:`locale encoding`.
263263
264264
Default: ``1`` in Python config, ``0`` in isolated config.
265265
266266
.. c:member:: int coerce_c_locale
267267
268-
If equals to 2, coerce the C locale.
268+
If equals to ``2``, coerce the C locale.
269269
270-
If equals to 1, read the LC_CTYPE locale to decide if it should be
270+
If equals to ``1``, read the LC_CTYPE locale to decide if it should be
271271
coerced.
272272
273273
See the :term:`locale encoding`.
@@ -282,8 +282,8 @@ PyPreConfig
282282
283283
.. c:member:: int dev_mode
284284
285-
If non-zero, enables the :ref:`Python Development Mode <devmode>`:
286-
see :c:member:`PyConfig.dev_mode`.
285+
:ref:`Python Development Mode <devmode>`: see
286+
:c:member:`PyConfig.dev_mode`.
287287
288288
Default: ``-1`` in Python mode, ``0`` in isolated mode.
289289
@@ -329,8 +329,10 @@ PyPreConfig
329329
330330
If non-zero, enable the :ref:`Python UTF-8 Mode <utf8-mode>`.
331331
332-
Set by the :option:`-X utf8 <-X>` command line option and the
333-
:envvar:`PYTHONUTF8` environment variable.
332+
Set to ``0`` or ``1`` by the :option:`-X utf8 <-X>` command line option
333+
and the :envvar:`PYTHONUTF8` environment variable.
334+
335+
Also set to ``1`` if the ``LC_CTYPE`` locale is ``C`` or ``POSIX``.
334336
335337
Default: ``-1`` in Python config and ``0`` in isolated config.
336338
@@ -555,7 +557,7 @@ PyConfig
555557
* Otherwise (``python -c code`` and ``python``), prepend an empty string,
556558
which means the current working directory.
557559
558-
Set to 1 by the :option:`-P` command line option and the
560+
Set to ``1`` by the :option:`-P` command line option and the
559561
:envvar:`PYTHONSAFEPATH` environment variable.
560562
561563
Default: ``0`` in Python config, ``1`` in isolated config.
@@ -592,10 +594,10 @@ PyConfig
592594
593595
.. c:member:: int buffered_stdio
594596
595-
If equals to 0 and :c:member:`~PyConfig.configure_c_stdio` is non-zero,
597+
If equals to ``0`` and :c:member:`~PyConfig.configure_c_stdio` is non-zero,
596598
disable buffering on the C streams stdout and stderr.
597599
598-
Set to 0 by the :option:`-u` command line option and the
600+
Set to ``0`` by the :option:`-u` command line option and the
599601
:envvar:`PYTHONUNBUFFERED` environment variable.
600602
601603
stdin is always opened in buffered mode.
@@ -604,11 +606,11 @@ PyConfig
604606
605607
.. c:member:: int bytes_warning
606608
607-
If equals to 1, issue a warning when comparing :class:`bytes` or
609+
If equals to ``1``, issue a warning when comparing :class:`bytes` or
608610
:class:`bytearray` with :class:`str`, or comparing :class:`bytes` with
609611
:class:`int`.
610612
611-
If equal or greater to 2, raise a :exc:`BytesWarning` exception in these
613+
If equal or greater to ``2``, raise a :exc:`BytesWarning` exception in these
612614
cases.
613615
614616
Incremented by the :option:`-b` command line option.
@@ -671,6 +673,9 @@ PyConfig
671673
672674
If non-zero, enable the :ref:`Python Development Mode <devmode>`.
673675
676+
Set to ``1`` by the :option:`-X dev <-X>` option and the
677+
:envvar:`PYTHONDEVMODE` environment variable.
678+
674679
Default: ``-1`` in Python mode, ``0`` in isolated mode.
675680
676681
.. c:member:: int dump_refs
@@ -800,7 +805,7 @@ PyConfig
800805
801806
Enter interactive mode after executing a script or a command.
802807
803-
If greater than 0, enable inspect: when a script is passed as first
808+
If greater than ``0``, enable inspect: when a script is passed as first
804809
argument or the -c option is used, enter interactive mode after executing
805810
the script or the command, even when :data:`sys.stdin` does not appear to
806811
be a terminal.
@@ -818,25 +823,27 @@ PyConfig
818823
819824
.. c:member:: int interactive
820825
821-
If greater than 0, enable the interactive mode (REPL).
826+
If greater than ``0``, enable the interactive mode (REPL).
822827
823828
Incremented by the :option:`-i` command line option.
824829
825830
Default: ``0``.
826831
827832
.. c:member:: int isolated
828833
829-
If greater than 0, enable isolated mode:
834+
If greater than ``0``, enable isolated mode:
830835
831-
* Set :c:member:`~PyConfig.safe_path` to 1:
836+
* Set :c:member:`~PyConfig.safe_path` to ``1``:
832837
don't prepend a potentially unsafe path to :data:`sys.path` at Python
833838
startup.
834-
* Set :c:member:`~PyConfig.use_environment` to 0.
835-
* Set :c:member:`~PyConfig.user_site_directory` to 0: don't add the user
839+
* Set :c:member:`~PyConfig.use_environment` to ``0``.
840+
* Set :c:member:`~PyConfig.user_site_directory` to ``0``: don't add the user
836841
site directory to :data:`sys.path`.
837842
* Python REPL doesn't import :mod:`readline` nor enable default readline
838843
configuration on interactive prompts.
839844
845+
Set to ``1`` by the :option:`-I` command line option.
846+
840847
Default: ``0`` in Python mode, ``1`` in isolated mode.
841848
842849
See also :c:member:`PyPreConfig.isolated`.
@@ -906,7 +913,7 @@ PyConfig
906913
907914
Module search paths: :data:`sys.path`.
908915
909-
If :c:member:`~PyConfig.module_search_paths_set` is equal to 0,
916+
If :c:member:`~PyConfig.module_search_paths_set` is equal to ``0``,
910917
:c:func:`Py_InitializeFromConfig` will replace
911918
:c:member:`~PyConfig.module_search_paths` and sets
912919
:c:member:`~PyConfig.module_search_paths_set` to ``1``.
@@ -970,7 +977,7 @@ PyConfig
970977
971978
.. c:member:: int parser_debug
972979
973-
Parser debug mode. If greater than 0, turn on parser debugging output (for expert only, depending
980+
Parser debug mode. If greater than ``0``, turn on parser debugging output (for expert only, depending
974981
on compilation options).
975982
976983
Incremented by the :option:`-d` command line option. Set to the
@@ -981,7 +988,7 @@ PyConfig
981988
.. c:member:: int pathconfig_warnings
982989
983990
If non-zero, calculation of path configuration is allowed to log
984-
warnings into ``stderr``. If equals to 0, suppress these warnings.
991+
warnings into ``stderr``. If equals to ``0``, suppress these warnings.
985992
986993
Default: ``1`` in Python mode, ``0`` in isolated mode.
987994
@@ -1031,7 +1038,7 @@ PyConfig
10311038
10321039
.. c:member:: int quiet
10331040
1034-
Quiet mode. If greater than 0, don't display the copyright and version at
1041+
Quiet mode. If greater than ``0``, don't display the copyright and version at
10351042
Python startup in interactive mode.
10361043
10371044
Incremented by the :option:`-q` command line option.
@@ -1071,7 +1078,7 @@ PyConfig
10711078
10721079
Show total reference count at exit?
10731080
1074-
Set to 1 by :option:`-X showrefcount <-X>` command line option.
1081+
Set to ``1`` by :option:`-X showrefcount <-X>` command line option.
10751082
10761083
Need a :ref:`debug build of Python <debug-build>` (the ``Py_REF_DEBUG``
10771084
macro must be defined).
@@ -1150,6 +1157,8 @@ PyConfig
11501157
If equals to zero, ignore the :ref:`environment variables
11511158
<using-on-envvars>`.
11521159
1160+
Set to ``0`` by the :option:`-E` environment variable.
1161+
11531162
Default: ``1`` in Python config and ``0`` in isolated config.
11541163
11551164
.. c:member:: int user_site_directory
@@ -1164,11 +1173,11 @@ PyConfig
11641173
11651174
.. c:member:: int verbose
11661175
1167-
Verbose mode. If greater than 0, print a message each time a module is
1176+
Verbose mode. If greater than ``0``, print a message each time a module is
11681177
imported, showing the place (filename or built-in module) from which
11691178
it is loaded.
11701179
1171-
If greater or equal to 2, print a message for each file that is checked
1180+
If greater or equal to ``2``, print a message for each file that is checked
11721181
for when searching for a module. Also provides information on module
11731182
cleanup at exit.
11741183
@@ -1199,7 +1208,7 @@ PyConfig
11991208
12001209
.. c:member:: int write_bytecode
12011210
1202-
If equal to 0, Python won't try to write ``.pyc`` files on the import of
1211+
If equal to ``0``, Python won't try to write ``.pyc`` files on the import of
12031212
source modules.
12041213
12051214
Set to ``0`` by the :option:`-B` command line option and the
@@ -1400,18 +1409,18 @@ Python Path Configuration
14001409
14011410
If at least one "output field" is not set, Python calculates the path
14021411
configuration to fill unset fields. If
1403-
:c:member:`~PyConfig.module_search_paths_set` is equal to 0,
1412+
:c:member:`~PyConfig.module_search_paths_set` is equal to ``0``,
14041413
:c:member:`~PyConfig.module_search_paths` is overridden and
1405-
:c:member:`~PyConfig.module_search_paths_set` is set to 1.
1414+
:c:member:`~PyConfig.module_search_paths_set` is set to ``1``.
14061415
14071416
It is possible to completely ignore the function calculating the default
14081417
path configuration by setting explicitly all path configuration output
14091418
fields listed above. A string is considered as set even if it is non-empty.
14101419
``module_search_paths`` is considered as set if
1411-
``module_search_paths_set`` is set to 1. In this case, path
1420+
``module_search_paths_set`` is set to ``1``. In this case, path
14121421
configuration input fields are ignored as well.
14131422
1414-
Set :c:member:`~PyConfig.pathconfig_warnings` to 0 to suppress warnings when
1423+
Set :c:member:`~PyConfig.pathconfig_warnings` to ``0`` to suppress warnings when
14151424
calculating the path configuration (Unix only, Windows does not log any warning).
14161425
14171426
If :c:member:`~PyConfig.base_prefix` or :c:member:`~PyConfig.base_exec_prefix`
@@ -1445,10 +1454,10 @@ The following configuration files are used by the path configuration:
14451454
14461455
If a ``._pth`` file is present:
14471456
1448-
* Set :c:member:`~PyConfig.isolated` to 1.
1449-
* Set :c:member:`~PyConfig.use_environment` to 0.
1450-
* Set :c:member:`~PyConfig.site_import` to 0.
1451-
* Set :c:member:`~PyConfig.safe_path` to 1.
1457+
* Set :c:member:`~PyConfig.isolated` to ``1``.
1458+
* Set :c:member:`~PyConfig.use_environment` to ``0``.
1459+
* Set :c:member:`~PyConfig.site_import` to ``0``.
1460+
* Set :c:member:`~PyConfig.safe_path` to ``1``.
14521461
14531462
The ``__PYVENV_LAUNCHER__`` environment variable is used to set
14541463
:c:member:`PyConfig.base_executable`
@@ -1511,7 +1520,7 @@ initialization, the core feature of :pep:`432`:
15111520
15121521
Private provisional API:
15131522
1514-
* :c:member:`PyConfig._init_main`: if set to 0,
1523+
* :c:member:`PyConfig._init_main`: if set to ``0``,
15151524
:c:func:`Py_InitializeFromConfig` stops at the "Core" initialization phase.
15161525
* :c:member:`PyConfig._isolated_interpreter`: if non-zero,
15171526
disallow threads, subprocesses and fork.

0 commit comments

Comments
 (0)