Skip to content

Commit 867df87

Browse files
committed
Merge branch 'main' into pythongh-129897-del-copywriter
2 parents 33ba1af + 78e09a4 commit 867df87

File tree

123 files changed

+4222
-2493
lines changed

Some content is hidden

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

123 files changed

+4222
-2493
lines changed

Doc/c-api/exceptions.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,11 @@ because the :ref:`call protocol <call>` takes care of recursion handling.
921921
922922
Marks a point where a recursive C-level call is about to be performed.
923923
924-
The function then checks if the stack limit is reached. If this is the
924+
If :c:macro:`!USE_STACKCHECK` is defined, this function checks if the OS
925+
stack overflowed using :c:func:`PyOS_CheckStack`. If this is the case, it
926+
sets a :exc:`MemoryError` and returns a nonzero value.
927+
928+
The function then checks if the recursion limit is reached. If this is the
925929
case, a :exc:`RecursionError` is set and a nonzero value is returned.
926930
Otherwise, zero is returned.
927931

Doc/c-api/module.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ The available slot types are:
415415
in one module definition.
416416
417417
If ``Py_mod_multiple_interpreters`` is not specified, the import
418-
machinery defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED``.
418+
machinery defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED``.
419419
420420
.. versionadded:: 3.12
421421

Doc/c-api/unicode.rst

+9
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,15 @@ APIs:
607607
decref'ing the returned objects.
608608
609609
610+
.. c:function:: const char* PyUnicode_GetDefaultEncoding(void)
611+
612+
Return the name of the default string encoding, ``"utf-8"``.
613+
See :func:`sys.getdefaultencoding`.
614+
615+
The returned string does not need to be freed, and is valid
616+
until interpreter shutdown.
617+
618+
610619
.. c:function:: Py_ssize_t PyUnicode_GetLength(PyObject *unicode)
611620
612621
Return the length of the Unicode object, in code points.

Doc/conf.py

+14-15
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
# The contents of this file are pickled, so don't put values in the namespace
77
# that aren't pickleable (module imports are okay, they're removed automatically).
88

9-
import importlib
109
import os
1110
import sys
11+
from importlib import import_module
12+
from importlib.util import find_spec
1213

1314
# Make our custom extensions available to Sphinx
1415
sys.path.append(os.path.abspath('tools/extensions'))
@@ -39,19 +40,17 @@
3940
]
4041

4142
# Skip if downstream redistributors haven't installed them
42-
try:
43-
import notfound.extension # noqa: F401
44-
except ImportError:
45-
pass
46-
else:
47-
extensions.append('notfound.extension')
48-
try:
49-
import sphinxext.opengraph # noqa: F401
50-
except ImportError:
51-
pass
52-
else:
53-
extensions.append('sphinxext.opengraph')
54-
43+
_OPTIONAL_EXTENSIONS = (
44+
'notfound.extension',
45+
'sphinxext.opengraph',
46+
)
47+
for optional_ext in _OPTIONAL_EXTENSIONS:
48+
try:
49+
if find_spec(optional_ext) is not None:
50+
extensions.append(optional_ext)
51+
except (ImportError, ValueError):
52+
pass
53+
del _OPTIONAL_EXTENSIONS
5554

5655
doctest_global_setup = '''
5756
try:
@@ -74,7 +73,7 @@
7473
# We look for the Include/patchlevel.h file in the current Python source tree
7574
# and replace the values accordingly.
7675
# See Doc/tools/extensions/patchlevel.py
77-
version, release = importlib.import_module('patchlevel').get_version_info()
76+
version, release = import_module('patchlevel').get_version_info()
7877

7978
rst_epilog = f"""
8079
.. |python_version_literal| replace:: ``Python {version}``

Doc/data/refcounts.dat

+3
Original file line numberDiff line numberDiff line change
@@ -2770,6 +2770,9 @@ PyUnicode_FromFormatV:PyObject*::+1:
27702770
PyUnicode_FromFormatV:const char*:format::
27712771
PyUnicode_FromFormatV:va_list:args::
27722772

2773+
PyUnicode_GetDefaultEncoding:const char*:::
2774+
PyUnicode_GetDefaultEncoding::void::
2775+
27732776
PyUnicode_GetLength:Py_ssize_t:::
27742777
PyUnicode_GetLength:PyObject*:unicode:0:
27752778

0 commit comments

Comments
 (0)