Skip to content

Commit f412f87

Browse files
committed
Merge branch 'main' into pythongh-78079-win-device-path-roots
2 parents bb0af91 + 24facd6 commit f412f87

File tree

370 files changed

+12107
-7892
lines changed

Some content is hidden

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

370 files changed

+12107
-7892
lines changed

.devcontainer/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM docker.io/library/fedora:37
2+
3+
ENV CC=clang
4+
5+
ENV WASI_SDK_VERSION=19
6+
ENV WASI_SDK_PATH=/opt/wasi-sdk
7+
8+
ENV WASMTIME_HOME=/opt/wasmtime
9+
ENV WASMTIME_VERSION=7.0.0
10+
ENV WASMTIME_CPU_ARCH=x86_64
11+
12+
RUN dnf -y --nodocs install git clang xz python3-blurb dnf-plugins-core && \
13+
dnf -y --nodocs builddep python3 && \
14+
dnf -y clean all
15+
16+
RUN mkdir ${WASI_SDK_PATH} && \
17+
curl --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-linux.tar.gz | \
18+
tar --strip-components 1 --directory ${WASI_SDK_PATH} --extract --gunzip
19+
20+
RUN mkdir --parents ${WASMTIME_HOME} && \
21+
curl --location "https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION}/wasmtime-v${WASMTIME_VERSION}-${WASMTIME_CPU_ARCH}-linux.tar.xz" | \
22+
xz --decompress | \
23+
tar --strip-components 1 --directory ${WASMTIME_HOME} -x && \
24+
ln -s ${WASMTIME_HOME}/wasmtime /usr/local/bin

.devcontainer/devcontainer.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"build": {
3+
"dockerfile": "Dockerfile"
4+
},
5+
"onCreateCommand": [
6+
// Install common tooling.
7+
"dnf",
8+
"install",
9+
"-y",
10+
"which",
11+
"zsh",
12+
"fish"
13+
],
14+
"updateContentCommand": {
15+
// Using the shell for `nproc` usage.
16+
"python": "./configure --config-cache --with-pydebug && make -s -j `nproc`",
17+
"docs": [
18+
"make",
19+
"--directory",
20+
"Doc",
21+
"venv",
22+
"html"
23+
]
24+
},
25+
"customizations": {
26+
"vscode": {
27+
"extensions": [
28+
// Highlighting for Parser/Python.asdl.
29+
"brettcannon.zephyr-asdl",
30+
// Highlighting for configure.ac.
31+
"maelvalais.autoconf",
32+
// C auto-complete.
33+
"ms-vscode.cpptools",
34+
// To view built docs.
35+
"ms-vscode.live-server"
36+
// https://github.com/microsoft/vscode-python/issues/18073
37+
// "ms-python.python"
38+
],
39+
"settings": {
40+
"C_Cpp.default.cStandard": "c11",
41+
"C_Cpp.default.defines": [
42+
"Py_BUILD_CORE"
43+
],
44+
// https://github.com/microsoft/vscode-cpptools/issues/10732
45+
"C_Cpp.errorSquiggles": "disabled",
46+
"editor.insertSpaces": true,
47+
"editor.rulers": [
48+
80
49+
],
50+
"editor.tabSize": 4,
51+
"editor.trimAutoWhitespace": true,
52+
"files.associations": {
53+
"*.h": "c"
54+
},
55+
"files.encoding": "utf8",
56+
"files.eol": "\n",
57+
"files.insertFinalNewline": true,
58+
"files.trimTrailingWhitespace": true,
59+
"python.analysis.diagnosticSeverityOverrides": {
60+
// Complains about shadowing the stdlib w/ the stdlib.
61+
"reportShadowedImports": "none",
62+
// Doesn't like _frozen_importlib.
63+
"reportMissingImports": "none"
64+
},
65+
"python.analysis.extraPaths": [
66+
"Lib"
67+
],
68+
"python.defaultInterpreterPath": "./python",
69+
"[restructuredtext]": {
70+
"editor.tabSize": 3
71+
}
72+
}
73+
}
74+
}
75+
}

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ jobs:
111111
run: make smelly
112112
- name: Check limited ABI symbols
113113
run: make check-limited-abi
114+
- name: Check for unsupported C global variables
115+
if: github.event_name == 'pull_request' # $GITHUB_EVENT_NAME
116+
run: make check-c-globals
114117

115118
build_win32:
116119
name: 'Windows (x86)'

.github/workflows/doc.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,29 @@ jobs:
5353
- name: 'Build HTML documentation'
5454
run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html
5555

56+
# Add pull request annotations for Sphinx nitpicks (missing references)
57+
- name: 'Get list of changed files'
58+
id: changed_files
59+
uses: Ana06/[email protected]
60+
with:
61+
filter: "Doc/**"
62+
- name: 'Build changed files in nit-picky mode'
63+
continue-on-error: true
64+
run: |
65+
# Mark files the pull request modified
66+
touch ${{ steps.changed_files.outputs.added_modified }}
67+
# Build docs with the '-n' (nit-picky) option; convert warnings to annotations
68+
make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n --keep-going" html 2>&1 |
69+
python Doc/tools/warnings-to-gh-actions.py
70+
71+
# Ensure some files always pass Sphinx nit-picky mode (no missing references)
72+
- name: 'Build known-good files in nit-picky mode'
73+
run: |
74+
# Mark files that must pass nit-picky
75+
python Doc/tools/touch-clean-files.py
76+
# Build docs with the '-n' (nit-picky) option, convert warnings to errors (-W)
77+
make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n -W --keep-going" html 2>&1
78+
5679
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
5780
doctest:
5881
name: 'Doctest'

Doc/c-api/exceptions.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ Printing and clearing
8686
8787
An exception must be set when calling this function.
8888
89+
.. c:function:: void PyErr_DisplayException(PyObject *exc)
90+
91+
Print the standard traceback display of ``exc`` to ``sys.stderr``, including
92+
chained exceptions and notes.
93+
94+
.. versionadded:: 3.12
8995
9096
Raising exceptions
9197
==================

Doc/c-api/gcsupport.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,3 +228,36 @@ garbage collection runs.
228228
Returns the current state, 0 for disabled and 1 for enabled.
229229
230230
.. versionadded:: 3.10
231+
232+
233+
Querying Garbage Collector State
234+
--------------------------------
235+
236+
The C-API provides the following interface for querying information about
237+
the garbage collector.
238+
239+
.. c:function:: void PyUnstable_GC_VisitObjects(gcvisitobjects_t callback, void *arg)
240+
241+
Run supplied *callback* on all live GC-capable objects. *arg* is passed through to
242+
all invocations of *callback*.
243+
244+
.. warning::
245+
If new objects are (de)allocated by the callback it is undefined if they
246+
will be visited.
247+
248+
Garbage collection is disabled during operation. Explicitly running a collection
249+
in the callback may lead to undefined behaviour e.g. visiting the same objects
250+
multiple times or not at all.
251+
252+
.. versionadded:: 3.12
253+
254+
.. c:type:: int (*gcvisitobjects_t)(PyObject *object, void *arg)
255+
256+
Type of the visitor function to be passed to :c:func:`PyUnstable_GC_VisitObjects`.
257+
*arg* is the same as the *arg* passed to ``PyUnstable_GC_VisitObjects``.
258+
Return ``0`` to continue iteration, return ``1`` to stop iteration. Other return
259+
values are reserved for now so behavior on returning anything else is undefined.
260+
261+
.. versionadded:: 3.12
262+
263+

Doc/c-api/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ Process-wide parameters
513513
program name is ``'/usr/local/bin/python'``, the prefix is ``'/usr/local'``. The
514514
returned string points into static storage; the caller should not modify its
515515
value. This corresponds to the :makevar:`prefix` variable in the top-level
516-
:file:`Makefile` and the ``--prefix`` argument to the :program:`configure`
516+
:file:`Makefile` and the :option:`--prefix` argument to the :program:`configure`
517517
script at build time. The value is available to Python code as ``sys.prefix``.
518518
It is only useful on Unix. See also the next function.
519519

Doc/c-api/intro.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,19 @@ used by extension writers. Structure member names do not have a reserved prefix.
7878

7979
The header files are typically installed with Python. On Unix, these are
8080
located in the directories :file:`{prefix}/include/pythonversion/` and
81-
:file:`{exec_prefix}/include/pythonversion/`, where :envvar:`prefix` and
82-
:envvar:`exec_prefix` are defined by the corresponding parameters to Python's
81+
:file:`{exec_prefix}/include/pythonversion/`, where :option:`prefix <--prefix>` and
82+
:option:`exec_prefix <--exec-prefix>` are defined by the corresponding parameters to Python's
8383
:program:`configure` script and *version* is
8484
``'%d.%d' % sys.version_info[:2]``. On Windows, the headers are installed
85-
in :file:`{prefix}/include`, where :envvar:`prefix` is the installation
85+
in :file:`{prefix}/include`, where ``prefix`` is the installation
8686
directory specified to the installer.
8787

8888
To include the headers, place both directories (if different) on your compiler's
8989
search path for includes. Do *not* place the parent directories on the search
9090
path and then use ``#include <pythonX.Y/Python.h>``; this will break on
9191
multi-platform builds since the platform independent headers under
92-
:envvar:`prefix` include the platform specific headers from
93-
:envvar:`exec_prefix`.
92+
:option:`prefix <--prefix>` include the platform specific headers from
93+
:option:`exec_prefix <--exec-prefix>`.
9494

9595
C++ users should note that although the API is defined entirely using C, the
9696
header files properly declare the entry points to be ``extern "C"``. As a result,

Doc/c-api/object.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,15 @@ Object Protocol
179179
If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool`
180180
will always return ``1`` for :const:`Py_EQ` and ``0`` for :const:`Py_NE`.
181181
182+
.. c:function:: PyObject* PyObject_Format(PyObject *obj, PyObject *format_spec)
183+
184+
Format *obj* using *format_spec*. This is equivalent to the Python
185+
expression ``format(obj, format_spec)``.
186+
187+
*format_spec* may be ``NULL``. In this case the call is equivalent
188+
to ``format(obj)``.
189+
Returns the formatted string on success, ``NULL`` on failure.
190+
182191
.. c:function:: PyObject* PyObject_Repr(PyObject *o)
183192
184193
.. index:: builtin: repr

Doc/c-api/weakref.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,13 @@ as much as it can.
6767
.. c:function:: PyObject* PyWeakref_GET_OBJECT(PyObject *ref)
6868
6969
Similar to :c:func:`PyWeakref_GetObject`, but does no error checking.
70+
71+
72+
.. c:function:: void PyObject_ClearWeakRefs(PyObject *object)
73+
74+
This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler
75+
to clear weak references.
76+
77+
This iterates through the weak references for *object* and calls callbacks
78+
for those references which have one. It returns when all callbacks have
79+
been attempted.

Doc/data/stable_abi.dat

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/howto/logging-cookbook.rst

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -340,23 +340,27 @@ adding a ``filters`` section parallel to ``formatters`` and ``handlers``:
340340

341341
.. code-block:: json
342342
343-
"filters": {
344-
"warnings_and_below": {
345-
"()" : "__main__.filter_maker",
346-
"level": "WARNING"
343+
{
344+
"filters": {
345+
"warnings_and_below": {
346+
"()" : "__main__.filter_maker",
347+
"level": "WARNING"
348+
}
347349
}
348350
}
349351
350352
and changing the section on the ``stdout`` handler to add it:
351353

352354
.. code-block:: json
353355
354-
"stdout": {
355-
"class": "logging.StreamHandler",
356-
"level": "INFO",
357-
"formatter": "simple",
358-
"stream": "ext://sys.stdout",
359-
"filters": ["warnings_and_below"]
356+
{
357+
"stdout": {
358+
"class": "logging.StreamHandler",
359+
"level": "INFO",
360+
"formatter": "simple",
361+
"stream": "ext://sys.stdout",
362+
"filters": ["warnings_and_below"]
363+
}
360364
}
361365
362366
A filter is just a function, so we can define the ``filter_maker`` (a factory

Doc/library/__main__.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ one mentioned below are preferred.
259259

260260
See :mod:`venv` for an example of a package with a minimal ``__main__.py``
261261
in the standard library. It doesn't contain a ``if __name__ == '__main__'``
262-
block. You can invoke it with ``python3 -m venv [directory]``.
262+
block. You can invoke it with ``python -m venv [directory]``.
263263

264264
See :mod:`runpy` for more details on the :option:`-m` flag to the
265265
interpreter executable.

0 commit comments

Comments
 (0)