Skip to content

Commit be3becc

Browse files
committed
Merge branch 'main' into inlinecomp2
* main: (82 commits) pythongh-101670: typo fix in PyImport_ExtendInittab() (python#101723) pythonGH-99293: Document that `Py_TPFLAGS_VALID_VERSION_TAG` shouldn't be used. (#pythonGH-101736) no-issue: Add Dong-hee Na as the cjkcodecs codeowner (pythongh-101731) pythongh-101678: Merge math_1_to_whatever() and math_1() (python#101730) pythongh-101678: refactor the math module to use special functions from c11 (pythonGH-101679) pythongh-85984: Remove legacy Lib/pty.py code. (python#92365) pythongh-98831: Use opcode metadata for stack_effect() (python#101704) pythongh-101283: Version was just released, so should be changed in 3.11.3 (pythonGH-101719) pythongh-101283: Fix use of unbound variable (pythonGH-101712) pythongh-101283: Improved fallback logic for subprocess with shell=True on Windows (pythonGH-101286) pythongh-101277: Port more itertools static types to heap types (python#101304) pythongh-98831: Modernize CALL and family (python#101508) pythonGH-101696: invalidate type version tag in `_PyStaticType_Dealloc` (python#101697) pythongh-100221: Fix creating dirs in `make sharedinstall` (pythonGH-100329) pythongh-101670: typo fix in PyImport_AppendInittab() (pythonGH-101672) pythongh-101196: Make isdir/isfile/exists faster on Windows (pythonGH-101324) pythongh-101614: Don't treat python3_d.dll as a Python DLL when checking extension modules for incompatibility (pythonGH-101615) pythongh-100933: Improve `check_element` helper in `test_xml_etree` (python#100934) pythonGH-101578: Normalize the current exception (pythonGH-101607) pythongh-47937: Note that Popen attributes are read-only (python#93070) ...
2 parents 8773653 + cb24118 commit be3becc

File tree

224 files changed

+11100
-7247
lines changed

Some content is hidden

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

224 files changed

+11100
-7247
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ Lib/ast.py @isidentical
151151

152152
**/*sysconfig* @FFY00
153153

154+
**/*cjkcodecs* @corona10
155+
154156
# macOS
155157
/Mac/ @python/macos-team
156158
**/*osx_support* @python/macos-team

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
[email protected] (behavioral bugs can be sent to [email protected]).
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+
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/c-api/typeobj.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,16 @@ and :c:type:`PyType_Type` effectively act as defaults.)
13131313
.. versionadded:: 3.10
13141314

13151315

1316+
.. data:: Py_TPFLAGS_VALID_VERSION_TAG
1317+
1318+
Internal. Do not set or unset this flag.
1319+
To indicate that a class has changed call :c:func:`PyType_Modified`
1320+
1321+
.. warning::
1322+
This flag is present in header files, but is an internal feature and should
1323+
not be used. It will be removed in a future version of CPython
1324+
1325+
13161326
.. c:member:: const char* PyTypeObject.tp_doc
13171327
13181328
An optional pointer to a NUL-terminated C string giving the docstring for this

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/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)