Skip to content

Commit 3b2813b

Browse files
Merge branch 'main' into enum_init
2 parents 4c7a9a8 + 255762c commit 3b2813b

File tree

71 files changed

+2149
-991
lines changed

Some content is hidden

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

71 files changed

+2149
-991
lines changed

.github/workflows/reusable-macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
run: |
4343
brew install pkg-config [email protected] xz gdbm tcl-tk@8 make
4444
# Because alternate versions are not symlinked into place by default:
45-
brew link tcl-tk@8
45+
brew link --overwrite tcl-tk@8
4646
- name: Configure CPython
4747
run: |
4848
GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \

Doc/c-api/monitoring.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,14 @@ See :mod:`sys.monitoring` for descriptions of the events.
7575
Fire a ``JUMP`` event.
7676
7777
78-
.. c:function:: int PyMonitoring_FireBranchEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset, PyObject *target_offset)
78+
.. c:function:: int PyMonitoring_FireBranchLeftEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset, PyObject *target_offset)
7979
80-
Fire a ``BRANCH`` event.
80+
Fire a ``BRANCH_LEFT`` event.
81+
82+
83+
.. c:function:: int PyMonitoring_FireBranchRightEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset, PyObject *target_offset)
84+
85+
Fire a ``BRANCH_RIGHT`` event.
8186
8287
8388
.. c:function:: int PyMonitoring_FireCReturnEvent(PyMonitoringState *state, PyObject *codelike, int32_t offset, PyObject *retval)
@@ -168,7 +173,8 @@ would typically correspond to a python function.
168173
================================================== =====================================
169174
Macro Event
170175
================================================== =====================================
171-
.. c:macro:: PY_MONITORING_EVENT_BRANCH :monitoring-event:`BRANCH`
176+
.. c:macro:: PY_MONITORING_EVENT_BRANCH_LEFT :monitoring-event:`BRANCH_LEFT`
177+
.. c:macro:: PY_MONITORING_EVENT_BRANCH_RIGHT :monitoring-event:`BRANCH_RIGHT`
172178
.. c:macro:: PY_MONITORING_EVENT_CALL :monitoring-event:`CALL`
173179
.. c:macro:: PY_MONITORING_EVENT_C_RAISE :monitoring-event:`C_RAISE`
174180
.. c:macro:: PY_MONITORING_EVENT_C_RETURN :monitoring-event:`C_RETURN`

Doc/c-api/weakref.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ as much as it can.
8888
Use :c:func:`PyWeakref_GetRef` instead.
8989
9090
91+
.. c:function:: int PyWeakref_IsDead(PyObject *ref)
92+
93+
Test if the weak reference *ref* is dead. Returns 1 if the reference is
94+
dead, 0 if it is alive, and -1 with an error set if *ref* is not a weak
95+
reference object.
96+
97+
.. versionadded:: 3.14
98+
99+
91100
.. c:function:: void PyObject_ClearWeakRefs(PyObject *object)
92101
93102
This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler

Doc/library/inspect.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,6 +1708,13 @@ which is a bitmap of the following flags:
17081708

17091709
.. versionadded:: 3.14
17101710

1711+
.. data:: CO_METHOD
1712+
1713+
The flag is set when the code object is a function defined in class
1714+
scope.
1715+
1716+
.. versionadded:: 3.14
1717+
17111718
.. note::
17121719
The flags are specific to CPython, and may not be defined in other
17131720
Python implementations. Furthermore, the flags are an implementation

Doc/library/os.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5420,10 +5420,22 @@ operating system.
54205420
Scheduling policy for CPU-intensive processes that tries to preserve
54215421
interactivity on the rest of the computer.
54225422

5423+
.. data:: SCHED_DEADLINE
5424+
5425+
Scheduling policy for tasks with deadline constraints.
5426+
5427+
.. versionadded:: next
5428+
54235429
.. data:: SCHED_IDLE
54245430

54255431
Scheduling policy for extremely low priority background tasks.
54265432

5433+
.. data:: SCHED_NORMAL
5434+
5435+
Alias for :data:`SCHED_OTHER`.
5436+
5437+
.. versionadded:: next
5438+
54275439
.. data:: SCHED_SPORADIC
54285440

54295441
Scheduling policy for sporadic server programs.

Doc/library/ssl.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,8 +2508,8 @@ thus several things you need to be aware of:
25082508
.. seealso::
25092509

25102510
The :mod:`asyncio` module supports :ref:`non-blocking SSL sockets
2511-
<ssl-nonblocking>` and provides a
2512-
higher level API. It polls for events using the :mod:`selectors` module and
2511+
<ssl-nonblocking>` and provides a higher level :ref:`Streams API <asyncio-streams>`.
2512+
It polls for events using the :mod:`selectors` module and
25132513
handles :exc:`SSLWantWriteError`, :exc:`SSLWantReadError` and
25142514
:exc:`BlockingIOError` exceptions. It runs the SSL handshake asynchronously
25152515
as well.

Doc/library/sys.monitoring.rst

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,17 @@ Events
7979

8080
The following events are supported:
8181

82-
.. monitoring-event:: BRANCH
82+
.. monitoring-event:: BRANCH_LEFT
8383

84-
A conditional branch is taken (or not).
84+
A conditional branch goes left.
85+
86+
It is up to the tool to determine how to present "left" and "right" branches.
87+
There is no guarantee which branch is "left" and which is "right", except
88+
that it will be consistent for the duration of the program.
89+
90+
.. monitoring-event:: BRANCH_RIGHT
91+
92+
A conditional branch goes right.
8593

8694
.. monitoring-event:: CALL
8795

@@ -180,9 +188,20 @@ The local events are:
180188
* :monitoring-event:`LINE`
181189
* :monitoring-event:`INSTRUCTION`
182190
* :monitoring-event:`JUMP`
183-
* :monitoring-event:`BRANCH`
191+
* :monitoring-event:`BRANCH_LEFT`
192+
* :monitoring-event:`BRANCH_RIGHT`
184193
* :monitoring-event:`STOP_ITERATION`
185194

195+
Deprecated event
196+
''''''''''''''''
197+
198+
* ``BRANCH``
199+
200+
The ``BRANCH`` event is deprecated in 3.14.
201+
Using :monitoring-event:`BRANCH_LEFT` and :monitoring-event:`BRANCH_RIGHT`
202+
events will give much better performance as they can be disabled
203+
independently.
204+
186205
Ancillary events
187206
''''''''''''''''
188207

@@ -357,13 +376,11 @@ Different events will provide the callback function with different arguments, as
357376

358377
func(code: CodeType, line_number: int) -> DISABLE | Any
359378

360-
* :monitoring-event:`BRANCH` and :monitoring-event:`JUMP`::
379+
* :monitoring-event:`BRANCH_LEFT`, :monitoring-event:`BRANCH_RIGHT` and :monitoring-event:`JUMP`::
361380

362381
func(code: CodeType, instruction_offset: int, destination_offset: int) -> DISABLE | Any
363382

364383
Note that the *destination_offset* is where the code will next execute.
365-
For an untaken branch this will be the offset of the instruction following
366-
the branch.
367384

368385
* :monitoring-event:`INSTRUCTION`::
369386

Doc/whatsnew/3.13.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1971,7 +1971,7 @@ New Features
19711971
* :c:func:`PyMonitoring_FireCallEvent`
19721972
* :c:func:`PyMonitoring_FireLineEvent`
19731973
* :c:func:`PyMonitoring_FireJumpEvent`
1974-
* :c:func:`PyMonitoring_FireBranchEvent`
1974+
* ``PyMonitoring_FireBranchEvent``
19751975
* :c:func:`PyMonitoring_FireCReturnEvent`
19761976
* :c:func:`PyMonitoring_FirePyThrowEvent`
19771977
* :c:func:`PyMonitoring_FireRaiseEvent`

Doc/whatsnew/3.14.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,10 @@ os
525525
same process.
526526
(Contributed by Victor Stinner in :gh:`120057`.)
527527

528+
* Add the :data:`~os.SCHED_DEADLINE` and :data:`~os.SCHED_NORMAL` constants
529+
to the :mod:`os` module.
530+
(Contributed by James Roy in :gh:`127688`.)
531+
528532

529533
pathlib
530534
-------
@@ -599,6 +603,11 @@ sys
599603
which only exists in specialized builds of Python, may now return objects
600604
from other interpreters than the one it's called in.
601605

606+
sys.monitoring
607+
--------------
608+
609+
Two new events are added: :monitoring-event:`BRANCH_LEFT` and
610+
:monitoring-event:`BRANCH_RIGHT`. The ``BRANCH`` event is deprecated.
602611

603612
tkinter
604613
-------
@@ -1140,6 +1149,11 @@ New features
11401149
a :exc:`UnicodeError` object.
11411150
(Contributed by Bénédikt Tran in :gh:`127691`.)
11421151

1152+
* Add :c:func:`PyMonitoring_FireBranchLeftEvent` and
1153+
:c:func:`PyMonitoring_FireBranchRightEvent` for generating
1154+
:monitoring-event:`BRANCH_LEFT` and :monitoring-event:`BRANCH_RIGHT`
1155+
events, respectively.
1156+
11431157

11441158
Porting to Python 3.14
11451159
----------------------
@@ -1173,6 +1187,10 @@ Deprecated
11731187

11741188
.. include:: ../deprecations/c-api-pending-removal-in-future.rst
11751189

1190+
* The ``PyMonitoring_FireBranchEvent`` function is deprecated and should
1191+
be replaced with calls to :c:func:`PyMonitoring_FireBranchLeftEvent`
1192+
and :c:func:`PyMonitoring_FireBranchRightEvent`.
1193+
11761194
Removed
11771195
-------
11781196

Include/cpython/code.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ extern "C" {
1111
/* Total tool ids available */
1212
#define _PY_MONITORING_TOOL_IDS 8
1313
/* Count of all local monitoring events */
14-
#define _PY_MONITORING_LOCAL_EVENTS 10
14+
#define _PY_MONITORING_LOCAL_EVENTS 11
1515
/* Count of all "real" monitoring events (not derived from other events) */
16-
#define _PY_MONITORING_UNGROUPED_EVENTS 15
16+
#define _PY_MONITORING_UNGROUPED_EVENTS 16
1717
/* Count of all monitoring events */
18-
#define _PY_MONITORING_EVENTS 17
18+
#define _PY_MONITORING_EVENTS 19
1919

2020
/* Tables of which tools are active for each monitored event. */
2121
typedef struct _Py_LocalMonitors {
@@ -199,6 +199,9 @@ struct PyCodeObject _PyCode_DEF(1);
199199
*/
200200
#define CO_HAS_DOCSTRING 0x4000000
201201

202+
/* A function defined in class scope */
203+
#define CO_METHOD 0x8000000
204+
202205
/* This should be defined if a future statement modifies the syntax.
203206
For example, when a keyword is added.
204207
*/

0 commit comments

Comments
 (0)