Skip to content

Commit 97e71d3

Browse files
Merge branch 'main' into long-from-dev_t
2 parents c0abdbb + 367adc9 commit 97e71d3

File tree

346 files changed

+13162
-7327
lines changed

Some content is hidden

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

346 files changed

+13162
-7327
lines changed

.github/CODEOWNERS

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,21 @@ Objects/type* @markshannon
2929
Objects/codeobject.c @markshannon
3030
Objects/frameobject.c @markshannon
3131
Objects/call.c @markshannon
32-
Python/ceval*.c @markshannon @gvanrossum
33-
Python/ceval*.h @markshannon @gvanrossum
32+
Python/ceval*.c @markshannon
33+
Python/ceval*.h @markshannon
3434
Python/compile.c @markshannon @iritkatriel
3535
Python/assemble.c @markshannon @iritkatriel
3636
Python/flowgraph.c @markshannon @iritkatriel
3737
Python/ast_opt.c @isidentical
38-
Python/bytecodes.c @markshannon @gvanrossum
39-
Python/optimizer*.c @markshannon @gvanrossum
38+
Python/bytecodes.c @markshannon
39+
Python/optimizer*.c @markshannon
4040
Python/optimizer_analysis.c @Fidget-Spinner
4141
Python/optimizer_bytecodes.c @Fidget-Spinner
42+
Lib/_pyrepl/* @pablogsal @lysnikolaou @ambv
4243
Lib/test/test_patma.py @brandtbucher
4344
Lib/test/test_type_*.py @JelleZijlstra
44-
Lib/test/test_capi/test_misc.py @markshannon @gvanrossum
45+
Lib/test/test_capi/test_misc.py @markshannon
46+
Lib/test/test_pyrepl/* @pablogsal @lysnikolaou @ambv
4547
Tools/c-analyzer/ @ericsnowcurrently
4648

4749
# dbm
@@ -150,7 +152,7 @@ Include/internal/pycore_time.h @pganssle @abalkin
150152
/Lib/test/test_tokenize.py @pablogsal @lysnikolaou
151153

152154
# Code generator
153-
/Tools/cases_generator/ @gvanrossum
155+
/Tools/cases_generator/ @markshannon
154156

155157
# AST
156158
Python/ast.c @isidentical

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ jobs:
388388
id: cache-hypothesis-database
389389
uses: actions/cache@v4
390390
with:
391-
path: ./hypothesis
391+
path: ${{ env.CPYTHON_BUILDDIR }}/.hypothesis/
392392
key: hypothesis-database-${{ github.head_ref || github.run_id }}
393393
restore-keys: |
394394
- hypothesis-database-
@@ -416,7 +416,7 @@ jobs:
416416
if: always()
417417
with:
418418
name: hypothesis-example-db
419-
path: .hypothesis/examples/
419+
path: ${{ env.CPYTHON_BUILDDIR }}/.hypothesis/examples/
420420

421421

422422
build_asan:

Doc/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,14 @@ gettext: build
150150
htmlview: html
151151
$(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('build/html/index.html'))"
152152

153+
.PHONY: ensure-sphinx-autobuild
154+
ensure-sphinx-autobuild: venv
155+
$(VENVDIR)/bin/sphinx-autobuild --version > /dev/null || $(VENVDIR)/bin/python3 -m pip install sphinx-autobuild
156+
153157
.PHONY: htmllive
154158
htmllive: SPHINXBUILD = $(VENVDIR)/bin/sphinx-autobuild
155159
htmllive: SPHINXOPTS = --re-ignore="/venv/" --open-browser --delay 0
156-
htmllive: html
160+
htmllive: ensure-sphinx-autobuild html
157161

158162
.PHONY: clean
159163
clean: clean-venv

Doc/c-api/buffer.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ a buffer, see :c:func:`PyObject_GetBuffer`.
147147
or a :c:macro:`PyBUF_WRITABLE` request, the consumer must disregard
148148
:c:member:`~Py_buffer.itemsize` and assume ``itemsize == 1``.
149149

150-
.. c:member:: const char *format
150+
.. c:member:: char *format
151151
152-
A *NUL* terminated string in :mod:`struct` module style syntax describing
152+
A *NULL* terminated string in :mod:`struct` module style syntax describing
153153
the contents of a single item. If this is ``NULL``, ``"B"`` (unsigned bytes)
154154
is assumed.
155155

Doc/c-api/monitoring.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
.. _monitoring:
44

5-
Monitorong C API
5+
Monitoring C API
66
================
77

88
Added in version 3.13.

Doc/c-api/reflection.rst

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,48 @@ Reflection
77

88
.. c:function:: PyObject* PyEval_GetBuiltins(void)
99
10+
.. deprecated:: 3.13
11+
12+
Use :c:func:`PyEval_GetFrameBuiltins` instead.
13+
1014
Return a dictionary of the builtins in the current execution frame,
1115
or the interpreter of the thread state if no frame is currently executing.
1216
1317
1418
.. c:function:: PyObject* PyEval_GetLocals(void)
1519
16-
Return a dictionary of the local variables in the current execution frame,
20+
.. deprecated:: 3.13
21+
22+
Use either :c:func:`PyEval_GetFrameLocals` to obtain the same behaviour as calling
23+
:func:`locals` in Python code, or else call :c:func:`PyFrame_GetLocals` on the result
24+
of :c:func:`PyEval_GetFrame` to access the :attr:`~frame.f_locals` attribute of the
25+
currently executing frame.
26+
27+
Return a mapping providing access to the local variables in the current execution frame,
1728
or ``NULL`` if no frame is currently executing.
1829
30+
Refer to :func:`locals` for details of the mapping returned at different scopes.
31+
32+
As this function returns a :term:`borrowed reference`, the dictionary returned for
33+
:term:`optimized scopes <optimized scope>` is cached on the frame object and will remain
34+
alive as long as the frame object does. Unlike :c:func:`PyEval_GetFrameLocals` and
35+
:func:`locals`, subsequent calls to this function in the same frame will update the
36+
contents of the cached dictionary to reflect changes in the state of the local variables
37+
rather than returning a new snapshot.
38+
39+
.. versionchanged:: 3.13
40+
As part of :pep:`667`, :c:func:`PyFrame_GetLocals`, :func:`locals`, and
41+
:attr:`FrameType.f_locals <frame.f_locals>` no longer make use of the shared cache
42+
dictionary. Refer to the :ref:`What's New entry <whatsnew313-locals-semantics>` for
43+
additional details.
44+
1945
2046
.. c:function:: PyObject* PyEval_GetGlobals(void)
2147
48+
.. deprecated:: 3.13
49+
50+
Use :c:func:`PyEval_GetFrameGlobals` instead.
51+
2252
Return a dictionary of the global variables in the current execution frame,
2353
or ``NULL`` if no frame is currently executing.
2454
@@ -31,6 +61,36 @@ Reflection
3161
See also :c:func:`PyThreadState_GetFrame`.
3262
3363
64+
.. c:function:: PyObject* PyEval_GetFrameBuiltins(void)
65+
66+
Return a dictionary of the builtins in the current execution frame,
67+
or the interpreter of the thread state if no frame is currently executing.
68+
69+
.. versionadded:: 3.13
70+
71+
72+
.. c:function:: PyObject* PyEval_GetFrameLocals(void)
73+
74+
Return a dictionary of the local variables in the current execution frame,
75+
or ``NULL`` if no frame is currently executing. Equivalent to calling
76+
:func:`locals` in Python code.
77+
78+
To access :attr:`~frame.f_locals` on the current frame without making an independent
79+
snapshot in :term:`optimized scopes <optimized scope>`, call :c:func:`PyFrame_GetLocals`
80+
on the result of :c:func:`PyEval_GetFrame`.
81+
82+
.. versionadded:: 3.13
83+
84+
85+
.. c:function:: PyObject* PyEval_GetFrameGlobals(void)
86+
87+
Return a dictionary of the global variables in the current execution frame,
88+
or ``NULL`` if no frame is currently executing. Equivalent to calling
89+
:func:`globals` in Python code.
90+
91+
.. versionadded:: 3.13
92+
93+
3494
.. c:function:: const char* PyEval_GetFuncName(PyObject *func)
3595
3696
Return the name of *func* if it is a function, class or instance object, else the

Doc/c-api/tuple.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ Tuple Objects
105105
is being replaced; any reference in the tuple at position *pos* will be
106106
leaked.
107107
108+
.. warning::
109+
110+
This macro should *only* be used on tuples that are newly created.
111+
Using this macro on a tuple that is already in use (or in other words, has
112+
a refcount > 1) could lead to undefined behavior.
113+
108114
109115
.. c:function:: int _PyTuple_Resize(PyObject **p, Py_ssize_t newsize)
110116

Doc/c-api/weakref.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ as much as it can.
3535
callable object that receives notification when *ob* is garbage collected; it
3636
should accept a single parameter, which will be the weak reference object
3737
itself. *callback* may also be ``None`` or ``NULL``. If *ob* is not a
38-
weakly referencable object, or if *callback* is not callable, ``None``, or
38+
weakly referenceable object, or if *callback* is not callable, ``None``, or
3939
``NULL``, this will return ``NULL`` and raise :exc:`TypeError`.
4040
4141
@@ -47,7 +47,7 @@ as much as it can.
4747
be a callable object that receives notification when *ob* is garbage
4848
collected; it should accept a single parameter, which will be the weak
4949
reference object itself. *callback* may also be ``None`` or ``NULL``. If *ob*
50-
is not a weakly referencable object, or if *callback* is not callable,
50+
is not a weakly referenceable object, or if *callback* is not callable,
5151
``None``, or ``NULL``, this will return ``NULL`` and raise :exc:`TypeError`.
5252
5353

Doc/data/refcounts.dat

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,12 @@ PyEval_GetGlobals:PyObject*::0:
790790

791791
PyEval_GetFrame:PyObject*::0:
792792

793+
PyEval_GetFrameBuiltins:PyObject*::+1:
794+
795+
PyEval_GetFrameLocals:PyObject*::+1:
796+
797+
PyEval_GetFrameGlobals:PyObject*::+1:
798+
793799
PyEval_GetFuncDesc:const char*:::
794800
PyEval_GetFuncDesc:PyObject*:func:0:
795801

@@ -916,6 +922,32 @@ PyFloat_FromString:PyObject*:str:0:
916922
PyFloat_GetInfo:PyObject*::+1:
917923
PyFloat_GetInfo::void::
918924

925+
PyFrame_GetBack:PyObject*::+1:
926+
PyFrame_GetBack:PyFrameObject*:frame:0:
927+
928+
PyFrame_GetBuiltins:PyObject*::+1:
929+
PyFrame_GetBuiltins:PyFrameObject*:frame:0:
930+
931+
PyFrame_GetCode:PyObject*::+1:
932+
PyFrame_GetCode:PyFrameObject*:frame:0:
933+
934+
PyFrame_GetGenerator:PyObject*::+1:
935+
PyFrame_GetGenerator:PyFrameObject*:frame:0:
936+
937+
PyFrame_GetGlobals:PyObject*::+1:
938+
PyFrame_GetGlobals:PyFrameObject*:frame:0:
939+
940+
PyFrame_GetLocals:PyObject*::+1:
941+
PyFrame_GetLocals:PyFrameObject*:frame:0:
942+
943+
PyFrame_GetVar:PyObject*::+1:
944+
PyFrame_GetVar:PyFrameObject*:frame:0:
945+
PyFrame_GetVar:PyObject*:name:0:
946+
947+
PyFrame_GetVarString:PyObject*::+1:
948+
PyFrame_GetVarString:PyFrameObject*:frame:0:
949+
PyFrame_GetVarString:const char*:name::
950+
919951
PyFrozenSet_Check:int:::
920952
PyFrozenSet_Check:PyObject*:p:0:
921953

Doc/extending/extending.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ It is important to call :c:func:`free` at the right time. If a block's address
868868
is forgotten but :c:func:`free` is not called for it, the memory it occupies
869869
cannot be reused until the program terminates. This is called a :dfn:`memory
870870
leak`. On the other hand, if a program calls :c:func:`free` for a block and then
871-
continues to use the block, it creates a conflict with re-use of the block
871+
continues to use the block, it creates a conflict with reuse of the block
872872
through another :c:func:`malloc` call. This is called :dfn:`using freed memory`.
873873
It has the same bad consequences as referencing uninitialized data --- core
874874
dumps, wrong results, mysterious crashes.

0 commit comments

Comments
 (0)