8000 Merge remote-tracking branch 'upstream/main' into int-freelist · python/cpython@1134727 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1134727

Browse files
committed
Merge remote-tracking branch 'upstream/main' into int-freelist
2 parents a9e76ad + d9de079 commit 1134727

File tree

242 files changed

+11463
-6951
lines changed

Some content is hidden

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

242 files changed

+11463
-6951
lines changed

Doc/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ VENVDIR = ./venv
99
SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build
1010
SPHINXLINT = PATH=$(VENVDIR)/bin:$$PATH sphinx-lint
1111
BLURB = PATH=$(VENVDIR)/bin:$$PATH blurb
12+
JOBS = auto
1213
PAPER =
1314
SOURCES =
1415
DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py)
@@ -18,7 +19,7 @@ SPHINXERRORHANDLING = -W
1819
PAPEROPT_a4 = -D latex_elements.papersize=a4paper
1920
PAPEROPT_letter = -D latex_elements.papersize=letterpaper
2021

21-
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees $(PAPEROPT_$(PAPER)) -j auto \
22+
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees $(PAPEROPT_$(PAPER)) -j $(JOBS) \
2223
$(SPHINXOPTS) $(SPHINXERRORHANDLING) . build/$(BUILDER) $(SOURCES)
2324

2425
.PHONY: help

Doc/bugs.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ If you find a bug in this documentation or would like to propose an improvement,
1919
please submit a bug report on the :ref:`tracker <using-the-tracker>`. If you
2020
have a suggestion on how to fix it, include that as well.
2121

22+
You can also open a discussion item on our
23+
`Documentation Discourse forum <https://discuss.python.org/c/documentation/26>`_.
24+
2225
If you're short on time, you can also email documentation bug reports to
2326
docs@python.org (behavioral bugs can be sent to python-list@python.org).
2427
'docs@' is a mailing list run by volunteers; your request will be noticed,

Doc/c-api/code.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ bound into a function.
7777
7878
Returns ``1`` if the function succeeds and 0 otherwise.
7979
80+
.. versionadded:: 3.11
81+
8082
.. c:function:: PyObject* PyCode_GetCode(PyCodeObject *co)
8183
8284
Equivalent to the Python code ``getattr(co, 'co_code')``.

Doc/c-api/exceptions.rst

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,61 @@ Querying the error indicator
400400
recursively in subtuples) are searched for a match.
401401
402402
403+
.. c:function:: PyObject *PyErr_GetRaisedException(void)
404+
405+
Returns the exception currently being raised, clearing the exception at
406+
the same time. Do not confuse this with the exception currently being
407+
handled which can be accessed with :c:func:`PyErr_GetHandledException`.
408+
409+
.. note::
410+
411+
This function is normally only used by code that needs to catch exceptions or
412+
by code that needs to save and restore the error indicator temporarily, e.g.::
413+
414+
{
415+
PyObject *exc = PyErr_GetRaisedException();
416+
417+
/* ... code that might produce other errors ... */
418+
419+
PyErr_SetRaisedException(exc);
420+
}
421+
422+
.. versionadded:: 3.12
423+
424+
425+
.. c:function:: void PyErr_SetRaisedException(PyObject *exc)
426+
427+
Sets the exception currently being raised ``exc``.
428+
If the exception is already set, it is cleared first.
429+
430+
``exc`` must be a valid exception.
431+
(Violating this rules will cause subtle problems later.)
432+
This call consumes a reference to the ``exc`` object: you must own a
433+
reference to that object before the call and after the call you no longer own
434+
that reference.
435+
(If you don't understand this, don't use this function. I warned you.)
436+
437+
.. note::
438+
439+
This function is normally only used by code that needs to save and restore the
440+
error indicator temporarily. Use :c:func:`PyErr_GetRaisedException` to save
441+
the current exception, e.g.::
442+
443+
{
444+
PyObject *exc = PyErr_GetRaisedException();
445+
446+
/* ... code that might produce other errors ... */
447+
448+
PyErr_SetRaisedException(exc);
449+
}
450+
451+
.. versionadded:: 3.12
452+
453+
10000
403454
.. c:function:: void PyErr_Fetch(PyObject **ptype, PyObject **pvalue, PyObject **ptraceback)
404455
456+
As of 3.12, this function is deprecated. Use :c:func:`PyErr_GetRaisedException` instead.
457+
405458
Retrieve the error indicator into three variables whose addresses are passed.
406459
If the error indicator is not set, set all three variables to ``NULL``. If it is
407460
set, it will be cleared and you own a reference to each object retrieved. The
@@ -421,10 +474,14 @@ Querying the error indicator
421474
PyErr_Restore(type, value, traceback);
422475
}
423476
477+
.. deprecated:: 3.12
478+
424479
425480
.. c:function:: void PyErr_Restore(PyObject *type, PyObject *value, PyObject *traceback)
426481
427-
Set the error indicator from the three objects. If the error indicator is
482+
As of 3.12, this function is deprecated. Use :c:func:`PyErr_SetRaisedException` instead.
483+
484+
Set the error indicator from the three objects. If the error indicator is
428485
already set, it is cleared first. If the objects are ``NULL``, the error
429486
indicator is cleared. Do not pass a ``NULL`` type and non-``NULL`` value or
430487
traceback. The exception type should be a class. Do not pass an invalid
@@ -440,9 +497,15 @@ Querying the error indicator
440497
error indicator temporarily. Use :c:func:`PyErr_Fetch` to save the current
441498
error indicator.
442499
500+
.. deprecated:: 3.12
501+
443502
444503
.. c:function:: void PyErr_NormalizeException(PyObject **exc, PyObject **val, PyObject **tb)
445504
505+
As of 3.12, this function is deprecated.
506+
Use :c:func:`PyErr_GetRaisedException` instead of :c:func:`PyErr_Fetch` to avoid
507+
any possible de-normalization.
508+
446509
Under certain circumstances, the values returned by :c:func:`PyErr_Fetch` below
447510
can be "unnormalized", meaning that ``*exc`` is a class object but ``*val`` is
448511
not an instance of the same class. This function can be used to instantiate
@@ -459,6 +522,8 @@ Querying the error indicator
459522
PyException_SetTraceback(val, tb);
460523
}
461524
525+
.. deprecated:: 3.12
526+
462527
463528
.. c:function:: PyObject* PyErr_GetHandledException(void)
464529
@@ -704,6 +769,18 @@ Exception Objects
704769
:attr:`__suppress_context__` is implicitly set to ``True`` by this function.
705770
706771
772+
.. c:function:: PyObject* PyException_GetArgs(PyObject *ex)
773+
774+
Return args of the given exception as a new reference,
775+
as accessible from Python through :attr:`args`.
776+
777+
778+
.. c:function:: void PyException_SetArgs(PyObject *ex, PyObject *args)
779+
780+
Set the args of the given exception,
781+
as accessible from Python through :attr:`args`.
782+
783+
707784
.. _unicodeexceptions:
708785
709786
Unicode Exception Objects

Doc/data/stable_abi.dat

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/faq/general.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ Are there any published articles about Python that I can reference?
248248

249249
It's probably best to cite your favorite book about Python.
250250

251-
The very first article about Python was written in 1991 and is now quite
252-
outdated.
251+
The `very first article <https://ir.cwi.nl/pub/18204>`_ about Python was
252+
written in 1991 and is now quite outdated.
253253

254254
Guido van Rossum and Jelke de Boer, "Interactively Testing Remote Servers
255255
Using the Python Programming Language", CWI Quarterly, Volume 4, Issue 4

Doc/howto/logging-cookbook.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ Suppose you configure logging with the following JSON:
307307
"class": "logging.StreamHandler",
308308
"level": "INFO",
309309
"formatter": "simple",
310-
"stream": "ext://sys.stdout",
310+
"stream": "ext://sys.stdout"
311311
},
312312
"stderr": {
313313
"class": "logging.StreamHandler",

Doc/library/argparse.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Core Functionality
3131

3232
The :mod:`argparse` module's support for command-line interfaces is built
3333
around an instance of :class:`argparse.ArgumentParser`. It is a container for
34-
argument specifications and has options that apply the parser as whole::
34+
argument specifications and has options that apply to the parser as whole::
3535

3636
parser = argparse.ArgumentParser(
3737
prog = 'ProgramName',

0 commit comments

Comments
 (0)
0