Skip to content

Commit be7eb0a

Browse files
committed
Catch up with main
2 parents 24ce84f + bdd8674 commit be7eb0a

File tree

676 files changed

+33043
-19077
lines changed

Some content is hidden

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

676 files changed

+33043
-19077
lines changed

.github/CODEOWNERS

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
.github/** @ezio-melotti
99

1010
# asyncio
11-
**/*asyncio* @1st1 @asvetlov @gvanrossum
11+
**/*asyncio* @1st1 @asvetlov @gvanrossum @kumaraditya303
1212

1313
# Core
1414
**/*context* @1st1
@@ -154,3 +154,6 @@ Lib/ast.py @isidentical
154154

155155
# pathlib
156156
**/*pathlib* @brettcannon
157+
158+
# zipfile.Path
159+
**/*zipfile/*_path.py @jaraco

.github/workflows/doc.yml

+6-1
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/Makefile

+24-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ PAPEROPT_letter = -D latex_elements.papersize=letterpaper
2121
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees $(PAPEROPT_$(PAPER)) -j auto \
2222
$(SPHINXOPTS) $(SPHINXERRORHANDLING) . build/$(BUILDER) $(SOURCES)
2323

24-
.PHONY: help build html htmlhelp latex text texinfo epub changes linkcheck \
25-
coverage doctest pydoc-topics htmlview clean clean-venv venv dist check serve \
26-
autobuild-dev autobuild-dev-html autobuild-stable autobuild-stable-html
27-
24+
.PHONY: help
2825
help:
2926
@echo "Please use \`make <target>' where <target> is one of"
3027
@echo " clean to remove build files"
@@ -44,6 +41,7 @@ help:
4441
@echo " dist to create a \"dist\" directory with archived docs for download"
4542
@echo " check to run a check for frequent markup errors"
4643

44+
.PHONY: build
4745
build:
4846
-mkdir -p build
4947
# Look first for a Misc/NEWS file (building from a source release tarball
@@ -70,70 +68,85 @@ build:
7068
$(SPHINXBUILD) $(ALLSPHINXOPTS)
7169
@echo
7270

71+
.PHONY: html
7372
html: BUILDER = html
7473
html: build
7574
@echo "Build finished. The HTML pages are in build/html."
7675

76+
.PHONY: htmlhelp
7777
htmlhelp: BUILDER = htmlhelp
7878
htmlhelp: build
7979
@echo "Build finished; now you can run HTML Help Workshop with the" \
8080
"build/htmlhelp/pydoc.hhp project file."
8181

82+
.PHONY: latex
8283
latex: BUILDER = latex
8384
latex: build
8485
@echo "Build finished; the LaTeX files are in build/latex."
8586
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
8687
"run these through (pdf)latex."
8788

89+
.PHONY: text
8890
text: BUILDER = text
8991
text: build
9092
@echo "Build finished; the text files are in build/text."
9193

94+
.PHONY: texinfo
9295
texinfo: BUILDER = texinfo
9396
texinfo: build
9497
@echo "Build finished; the python.texi file is in build/texinfo."
9598
@echo "Run \`make info' in that directory to run it through makeinfo."
9699

100+
.PHONY: epub
97101
epub: BUILDER = epub
98102
epub: build
99103
@echo "Build finished; the epub files are in build/epub."
100104

105+
.PHONY: changes
101106
changes: BUILDER = changes
102107
changes: build
103108
@echo "The overview file is in build/changes."
104109

110+
.PHONY: linkcheck
105111
linkcheck: BUILDER = linkcheck
106112
linkcheck:
107113
@$(MAKE) build BUILDER=$(BUILDER) || { \
108114
echo "Link check complete; look for any errors in the above output" \
109115
"or in build/$(BUILDER)/output.txt"; \
110116
false; }
111117

118+
.PHONY: coverage
112119
coverage: BUILDER = coverage
113120
coverage: build
114121
@echo "Coverage finished; see c.txt and python.txt in build/coverage"
115122

123+
.PHONY: doctest
116124
doctest: BUILDER = doctest
117125
doctest:
118126
@$(MAKE) build BUILDER=$(BUILDER) || { \
119127
echo "Testing of doctests in the sources finished, look at the" \
120128
"results in build/doctest/output.txt"; \
121129
false; }
122130

131+
.PHONY: pydoc-topics
123132
pydoc-topics: BUILDER = pydoc-topics
124133
pydoc-topics: build
125134
@echo "Building finished; now run this:" \
126135
"cp build/pydoc-topics/topics.py ../Lib/pydoc_data/topics.py"
127136

137+
.PHONY: htmlview
128138
htmlview: html
129139
$(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('build/html/index.html'))"
130140

141+
.PHONY: clean
131142
clean: clean-venv
132143
-rm -rf build/*
133144

145+
.PHONY: clean-venv
134146
clean-venv:
135147
rm -rf $(VENVDIR)
136148

149+
.PHONY: venv
137150
venv:
138151
@if [ -d $(VENVDIR) ] ; then \
139152
echo "venv already exists."; \
@@ -145,6 +158,7 @@ venv:
145158
echo "The venv has been created in the $(VENVDIR) directory"; \
146159
fi
147160

161+
.PHONY: dist
148162
dist:
149163
rm -rf dist
150164
mkdir -p dist
@@ -199,12 +213,14 @@ dist:
199213
rm -r dist/python-$(DISTVERSION)-docs-texinfo
200214
rm dist/python-$(DISTVERSION)-docs-texinfo.tar
201215

216+
.PHONY: check
202217
check:
203218
# Check the docs and NEWS files with sphinx-lint.
204219
# Ignore the tools and venv dirs and check that the default role is not used.
205220
$(SPHINXLINT) -i tools -i $(VENVDIR) --enable default-role
206221
$(SPHINXLINT) --enable default-role ../Misc/NEWS.d/next/
207222

223+
.PHONY: serve
208224
serve:
209225
@echo "The serve target was removed, use htmlview instead (see bpo-36329)"
210226

@@ -216,22 +232,26 @@ serve:
216232
# output files)
217233

218234
# for development releases: always build
235+
.PHONY: autobuild-dev
219236
autobuild-dev:
220237
make dist SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1'
221238

222239
# for quick rebuilds (HTML only)
240+
.PHONY: autobuild-dev-html
223241
autobuild-dev-html:
224242
make html SPHINXOPTS='$(SPHINXOPTS) -Ea -A daily=1'
225243

226244
# for stable releases: only build if not in pre-release stage (alpha, beta)
227245
# release candidate downloads are okay, since the stable tree can be in that stage
246+
.PHONY: autobuild-stable
228247
autobuild-stable:
229248
@case $(DISTVERSION) in *[ab]*) \
230249
echo "Not building; $(DISTVERSION) is not a release version."; \
231250
exit 1;; \
232251
esac
233252
@make autobuild-dev
234253

254+
.PHONY: autobuild-stable-html
235255
autobuild-stable-html:
236256
@case $(DISTVERSION) in *[ab]*) \
237257
echo "Not building; $(DISTVERSION) is not a release version."; \

Doc/_static/og-image.png

14.2 KB
Loading

Doc/c-api/code.rst

+48
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,51 @@ bound into a function.
115115
the free variables. On error, ``NULL`` is returned and an exception is raised.
116116
117117
.. versionadded:: 3.11
118+
119+
.. c:function:: int PyCode_AddWatcher(PyCode_WatchCallback callback)
120+
121+
Register *callback* as a code object watcher for the current interpreter.
122+
Return an ID which may be passed to :c:func:`PyCode_ClearWatcher`.
123+
In case of error (e.g. no more watcher IDs available),
124+
return ``-1`` and set an exception.
125+
126+
.. versionadded:: 3.12
127+
128+
.. c:function:: int PyCode_ClearWatcher(int watcher_id)
129+
130+
Clear watcher identified by *watcher_id* previously returned from
131+
:c:func:`PyCode_AddWatcher` for the current interpreter.
132+
Return ``0`` on success, or ``-1`` and set an exception on error
133+
(e.g. if the given *watcher_id* was never registered.)
134+
135+
.. versionadded:: 3.12
136+
137+
.. c:type:: PyCodeEvent
138+
139+
Enumeration of possible code object watcher events:
140+
- ``PY_CODE_EVENT_CREATE``
141+
- ``PY_CODE_EVENT_DESTROY``
142+
143+
.. versionadded:: 3.12
144+
145+
.. c:type:: int (*PyCode_WatchCallback)(PyCodeEvent event, PyCodeObject* co)
146+
147+
Type of a code object watcher callback function.
148+
149+
If *event* is ``PY_CODE_EVENT_CREATE``, then the callback is invoked
150+
after `co` has been fully initialized. Otherwise, the callback is invoked
151+
before the destruction of *co* takes place, so the prior state of *co*
152+
can be inspected.
153+
154+
Users of this API should not rely on internal runtime implementation
155+
details. Such details may include, but are not limited to, the exact
156+
order and timing of creation and destruction of code objects. While
157+
changes in these details may result in differences observable by watchers
158+
(including whether a callback is invoked or not), it does not change
159+
the semantics of the Python code being executed.
160+
161+
If the callback returns with an exception set, it must return ``-1``; this
162+
exception will be printed as an unraisable exception using
163+
:c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``.
164+
165+
.. versionadded:: 3.12

Doc/c-api/frame.rst

+20
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
@@ -87,6 +105,8 @@ See also :ref:`Reflection <reflection>`.
87105
* Raise :exc:`NameError` and return ``NULL`` if the variable does not exist.
88106
* Raise an exception and return ``NULL`` on error.
89107
108+
*name* type must be a :class:`str`.
109+
90110
.. versionadded:: 3.12
91111
92112

Doc/c-api/function.rst

+60
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

+1-1
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``.

0 commit comments

Comments
 (0)