8000 Merge branch 'main' into fix_ac_str_converter_cleanup · python/cpython@adce0ab · GitHub
[go: up one dir, main page]

Skip to content

Commit adce0ab

Browse files
committed
Merge branch 'main' into fix_ac_str_converter_cleanup
2 parents cf16400 + 0c1fbc1 commit adce0ab

File tree

532 files changed

+27558
-26476
lines changed

Some content is hidden

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

532 files changed

+27558
-26476
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Doc/library/token-list.inc generated
6969
Include/internal/pycore_ast.h generated
7070
Include/internal/pycore_ast_state.h generated
7171
Include/internal/pycore_opcode.h generated
72-
Include/internal/pycore_runtime_init_generated.h generated
72+
Include/internal/pycore_*_generated.h generated
7373
Include/opcode.h generated
7474
Include/token.h generated
7575
Lib/keyword.py generated

.github/CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Python/traceback.c @iritkatriel
6363
# bytecode.
6464
**/*import*.c @brettcannon @encukou @ericsnowcurrently @ncoghlan @warsaw
6565
**/*import*.py @brettcannon @encukou @ericsnowcurrently @ncoghlan @warsaw
66-
**/*importlib/resources/* @jaraco @warsaw @brettcannon
66+
**/*importlib/resources/* @jaraco @warsaw @brettcannon @FFY00
6767
**/importlib/metadata/* @jaraco @warsaw
6868

6969
# Dates and times
@@ -137,8 +137,6 @@ Lib/ast.py @isidentical
137137

138138
**/*typing* @gvanrossum @Fidget-Spinner @JelleZijlstra @AlexWaygood
139139

140-
**/*asyncore @giampaolo
141-
**/*asynchat @giampaolo
142140
**/*ftplib @giampaolo
143141
**/*shutil @giampaolo
144142

@@ -148,6 +146,8 @@ Lib/ast.py @isidentical
148146

149147
**/*tomllib* @encukou
150148

149+
**/*sysconfig* @FFY00
150+
151151
# macOS
152152
/Mac/ @python/macos-team
153153
**/*osx_support* @python/macos-team

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ jobs:
176176
needs: check_source
177177
if: needs.check_source.outputs.run_tests == 'true'
178178
env:
179-
OPENSSL_VER: 1.1.1q
179+
OPENSSL_VER: 1.1.1s
180180
PYTHONSTRICTEXTENSIONBUILD: 1
181181
steps:
182182
- uses: actions/checkout@v3
@@ -235,7 +235,7 @@ jobs:
235235
strategy:
236236
fail-fast: false
237237
matrix:
238-
openssl_ver: [1.1.1q, 3.0.5]
238+
openssl_ver: [1.1.1s, 3.0.7]
239239
env:
240240
OPENSSL_VER: ${{ matrix.openssl_ver }}
241241
MULTISSL_DIR: ${{ github.workspace }}/multissl
@@ -282,7 +282,7 @@ jobs:
282282
needs: check_source
283283
if: needs.check_source.outputs.run_tests == 'true'
284284
env:
285-
OPENSSL_VER: 1.1.1q
285+
OPENSSL_VER: 1.1.1s
286286
PYTHONSTRICTEXTENSIONBUILD: 1
287287
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
288288
steps:

.github/workflows/doc.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,14 @@ jobs:
5050
run: make -C Doc/ venv
5151
- name: 'Check documentation'
5252
run: make -C Doc/ check
53+
- name: 'Upload NEWS'
54+
uses: actions/upload-artifact@v3
55+
with:
56+
name: NEWS
57+
path: Doc/build/NEWS
5358
- name: 'Build HTML documentation'
5459
run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html
55-
- name: 'Upload'
60+
- name: 'Upload docs'
5661
uses: actions/upload-artifact@v3
5762
with:
5863
name: doc-html

Doc/c-api/frame.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,24 @@ can be used to get a frame object.
1919

2020
See also :ref:`Reflection <reflection>`.
2121

22+
.. c:var:: PyTypeObject PyFrame_Type
23+
24+
The type of frame objects.
25+
It is the same object as :py:class:`types.FrameType` in the Python layer.
26+
27+
.. versionchanged:: 3.11
28+
29+
Previously, this type was only available after including
30+
``<frameobject.h>``.
31+
32+
.. c:function:: int PyFrame_Check(PyObject *obj)
33+
34+
Return non-zero if *obj* is a frame object.
35+
36+
.. versionchanged:: 3.11
37+
38+
Previously, this function was only available after including
39+
``<frameobject.h>``.
2240
2341
.. c:function:: PyFrameObject* PyFrame_GetBack(PyFrameObject *frame)
2442
@@ -79,6 +97,27 @@ See also :ref:`Reflection <reflection>`.
7997
.. versionadded:: 3.11
8098
8199
100+
.. c:function:: PyObject* PyFrame_GetVar(PyFrameObject *frame, PyObject *name)
101+
102+
Get the variable *name* of *frame*.
103+
104+
* Return a :term:`strong reference` to the variable value on success.
105+
* Raise :exc:`NameError` and return ``NULL`` if the variable does not exist.
106+
* Raise an exception and return ``NULL`` on error.
107+
108+
*name* type must be a :class:`str`.
109+
110+
.. versionadded:: 3.12
111+
112+
113+
.. c:function:: PyObject* PyFrame_GetVarString(PyFrameObject *frame, const char *name)
114+
115+
Similar to :c:func:`PyFrame_GetVar`, but the variable name is a C string
116+
encoded in UTF-8.
117+
118+
.. versionadded:: 3.12
119+
120+
82121
.. c:function:: PyObject* PyFrame_GetLocals(PyFrameObject *frame)
83122
84123
Get the *frame*'s ``f_locals`` attribute (:class:`dict`).

Doc/c-api/function.rst

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,63 @@ There are a few functions specific to Python functions.
118118
must be a dictionary or ``Py_None``.
119119
120120
Raises :exc:`SystemError` and returns ``-1`` on failure.
121+
122+
123+
.. c:function:: int PyFunction_AddWatcher(PyFunction_WatchCallback callback)
124+
125+
Register *callback* as a function watcher for the current interpreter.
126+
Return an ID which may be passed to :c:func:`PyFunction_ClearWatcher`.
127+
In case of error (e.g. no more watcher IDs available),
128+
return ``-1`` and set an exception.
129+
130+
.. versionadded:: 3.12
131+
132+
133+
.. c:function:: int PyFunction_ClearWatcher(int watcher_id)
134+
135+
Clear watcher identified by *watcher_id* previously returned from
136+
:c:func:`PyFunction_AddWatcher` for the current interpreter.
137+
Return ``0`` on success, or ``-1`` and set an exception on error
138+
(e.g. if the given *watcher_id* was never registered.)
139+
140+
.. versionadded:: 3.12
141+
142+
143+
.. c:type:: PyFunction_WatchEvent
144+
145+
Enumeration of possible function watcher events:
146+
- ``PyFunction_EVENT_CREATE``
147+
- ``PyFunction_EVENT_DESTROY``
148+
- ``PyFunction_EVENT_MODIFY_CODE``
149+
- ``PyFunction_EVENT_MODIFY_DEFAULTS``
150+
- ``PyFunction_EVENT_MODIFY_KWDEFAULTS``
151+
152+
.. versionadded:: 3.12
153+
154+
155+
.. c:type:: int (*PyFunction_WatchCallback)(PyFunction_WatchEvent event, PyFunctionObject *func, PyObject *new_value)
156+
157+
Type of a function watcher callback function.
158+
159+
If *event* is ``PyFunction_EVENT_CREATE`` or ``PyFunction_EVENT_DESTROY``
160+
then *new_value* will be ``NULL``. Otherwise, *new_value* will hold a
161+
:term:`borrowed reference` to the new value that is about to be stored in
162+
*func* for the attribute that is being modified.
163+
164+
The callback may inspect but must not modify *func*; doing so could have
165+
unpredictable effects, including infinite recursion.
166+
167+
If *event* is ``PyFunction_EVENT_CREATE``, then the callback is invoked
168+
after `func` has been fully initialized. Otherwise, the callback is invoked
169+
before the modification to *func* takes place, so the prior state of *func*
170+
can be inspected. The runtime is permitted to optimize away the creation of
171+
function objects when possible. In such cases no event will be emitted.
172+
Although this creates the possitibility of an observable difference of
173+
runtime behavior depending on optimization decisions, it does not change
174+
the semantics of the Python code being executed.
175+
176+
If the callback returns with an exception set, it must return ``-1``; this
177+
exception will be printed as an unraisable exception using
178+
:c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``.
179+
180+
.. versionadded:: 3.12

Doc/c-api/init_config.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ PyPreConfig
254254
255255
.. c:member:: int configure_locale
256256
257-
Set the LC_CTYPE locale to the user preferred locale?
257+
Set the LC_CTYPE locale to the user preferred locale.
258258
259259
If equals to ``0``, set :c:member:`~PyPreConfig.coerce_c_locale` and
260260
:c:member:`~PyPreConfig.coerce_c_locale_warn` members to ``0``.

Doc/c-api/refcounting.rst

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
Reference Counting
88
******************
99

10-
The macros in this section are used for managing reference counts of Python
11-
objects.
10+
The functions and macros in this section are used for managing reference counts
11+
of Python objects.
1212

1313

1414
.. c:function:: Py_ssize_t Py_REFCNT(PyObject *o)
@@ -129,6 +129,11 @@ objects.
129129
It is a good idea to use this macro whenever decrementing the reference
130130
count of an object that might be traversed during garbage collection.
131131
132+
.. versionchanged:: 3.12
133+
The macro argument is now only evaluated once. If the argument has side
134+
effects, these are no longer duplicated.
135+
136+
132137
.. c:function:: void Py_IncRef(PyObject *o)
133138
134139
Increment the reference count for object *o*. A function version of :c:f F438 unc:`Py_XINCREF`.
@@ -139,3 +144,40 @@ objects.
139144
140145
Decrement the reference count for object *o*. A function version of :c:func:`Py_XDECREF`.
141146
It can be used for runtime dynamic embedding of Python.
147+
148+
149+
.. c:macro:: Py_SETREF(dst, src)
150+
151+
Macro safely decrementing the `dst` reference count and setting `dst` to
152+
`src`.
153+
154+
As in case of :c:func:`Py_CLEAR`, "the obvious" code can be deadly::
155+
156+
Py_DECREF(dst);
157+
dst = src;
158+
159+
The safe way is::
160+
161+
Py_SETREF(dst, src);
162+
163+
That arranges to set `dst` to `src` _before_ decrementing reference count of
164+
*dst* old value, so that any code triggered as a side-effect of `dst`
165+
getting torn down no longer believes `dst` points to a valid object.
166+
167+
.. versionadded:: 3.6
168+
169+
.. versionchanged:: 3.12
170+
The macro arguments are now only evaluated once. If an argument has side
171+
effects, these are no longer duplicated.
172+
173+
174+
.. c:macro:: Py_XSETREF(dst, src)
175+
176+
Variant of :c:macro:`Py_SETREF` macro that uses :c:func:`Py_XDECREF` instead
177+
of :c:func:`Py_DECREF`.
178+
179+
.. versionadded:: 3.6
180+
181+
.. versionchanged:: 3.12
182+
The macro arguments are now only evaluated once. If an argument has side
183+
effects, these are no longer duplicated.

0 commit comments

Comments
 (0)
0