Skip to content

Commit

Permalink
Merge branch 'main' into ios-minversion
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Jul 11, 2024
2 parents 8f22f24 + e8c91d9 commit cbd760e
Show file tree
Hide file tree
Showing 223 changed files with 3,449 additions and 1,521 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ENV WASI_SDK_VERSION=21
ENV WASI_SDK_PATH=/opt/wasi-sdk

ENV WASMTIME_HOME=/opt/wasmtime
ENV WASMTIME_VERSION=18.0.3
ENV WASMTIME_VERSION=22.0.0
ENV WASMTIME_CPU_ARCH=x86_64

RUN dnf -y --nodocs --setopt=install_weak_deps=False install /usr/bin/{blurb,clang,curl,git,ln,tar,xz} 'dnf-command(builddep)' && \
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Include/internal/pycore_freelist.h @ericsnowcurrently
Include/internal/pycore_global_objects.h @ericsnowcurrently
Include/internal/pycore_obmalloc.h @ericsnowcurrently
Include/internal/pycore_pymem.h @ericsnowcurrently
Include/internal/pycore_stackref.h @Fidget-Spinner
Modules/main.c @ericsnowcurrently
Programs/_bootstrap_python.c @ericsnowcurrently
Programs/python.c @ericsnowcurrently
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/reusable-wasi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
timeout-minutes: 60
runs-on: ubuntu-22.04
env:
WASMTIME_VERSION: 18.0.3
WASMTIME_VERSION: 22.0.0
WASI_SDK_VERSION: 21
WASI_SDK_PATH: /opt/wasi-sdk
CROSS_BUILD_PYTHON: cross-build/build
Expand All @@ -20,9 +20,9 @@ jobs:
- uses: actions/checkout@v4
# No problem resolver registered as one doesn't currently exist for Clang.
- name: "Install wasmtime"
uses: jcbhmr/setup-wasmtime@v2
uses: bytecodealliance/actions/wasmtime/setup@v1
with:
wasmtime-version: ${{ env.WASMTIME_VERSION }}
version: ${{ env.WASMTIME_VERSION }}
- name: "Restore WASI SDK"
id: cache-wasi-sdk
uses: actions/cache@v4
Expand Down Expand Up @@ -50,8 +50,10 @@ jobs:
uses: actions/cache@v4
with:
path: ${{ env.CROSS_BUILD_PYTHON }}/config.cache
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}-${{ env.pythonLocation }}
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python.
# Include the hash of `Tools/wasm/wasi.py` as it may change the environment variables.
# (Make sure to keep the key in sync with the other config.cache step below.)
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ env.WASI_SDK_VERSION }}-${{ env.WASMTIME_VERSION }}-${{ inputs.config_hash }}-${{ hashFiles('Tools/wasm/wasi.py') }}-${{ env.pythonLocation }}
- name: "Configure build Python"
run: python3 Tools/wasm/wasi.py configure-build-python -- --config-cache --with-pydebug
- name: "Make build Python"
Expand All @@ -60,8 +62,8 @@ jobs:
uses: actions/cache@v4
with:
path: ${{ env.CROSS_BUILD_WASI }}/config.cache
# Include env.pythonLocation in key to avoid changes in environment when setup-python updates Python
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-wasi-sdk-${{ env.WASI_SDK_VERSION }}-${{ inputs.config_hash }}-${{ env.pythonLocation }}
# Should be kept in sync with the other config.cache step above.
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ env.WASI_SDK_VERSION }}-${{ env.WASMTIME_VERSION }}-${{ inputs.config_hash }}-${{ hashFiles('Tools/wasm/wasi.py') }}-${{ env.pythonLocation }}
- name: "Configure host"
# `--with-pydebug` inferred from configure-build-python
run: python3 Tools/wasm/wasi.py configure-host -- --config-cache
Expand Down
9 changes: 6 additions & 3 deletions Doc/c-api/cell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ Cell objects are not likely to be useful elsewhere.
.. c:function:: PyObject* PyCell_Get(PyObject *cell)
Return the contents of the cell *cell*.
Return the contents of the cell *cell*, which can be ``NULL``.
If *cell* is not a cell object, returns ``NULL`` with an exception set.
.. c:function:: PyObject* PyCell_GET(PyObject *cell)
Expand All @@ -52,8 +53,10 @@ Cell objects are not likely to be useful elsewhere.
Set the contents of the cell object *cell* to *value*. This releases the
reference to any current content of the cell. *value* may be ``NULL``. *cell*
must be non-``NULL``; if it is not a cell object, ``-1`` will be returned. On
success, ``0`` will be returned.
must be non-``NULL``.
On success, return ``0``.
If *cell* is not a cell object, set an exception and return ``-1``.
.. c:function:: void PyCell_SET(PyObject *cell, PyObject *value)
Expand Down
23 changes: 15 additions & 8 deletions Doc/c-api/module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Module Objects
to ``None``); the caller is responsible for providing a :attr:`__file__`
attribute.
Return ``NULL`` with an exception set on error.
.. versionadded:: 3.3
.. versionchanged:: 3.4
Expand Down Expand Up @@ -265,6 +267,8 @@ of the following two module creation functions:
API version *module_api_version*. If that version does not match the version
of the running interpreter, a :exc:`RuntimeWarning` is emitted.
Return ``NULL`` with an exception set on error.
.. note::
Most uses of this function should be using :c:func:`PyModule_Create`
Expand Down Expand Up @@ -461,6 +465,8 @@ objects dynamically. Note that both ``PyModule_FromDefAndSpec`` and
If that version does not match the version of the running interpreter,
a :exc:`RuntimeWarning` is emitted.
Return ``NULL`` with an exception set on error.
.. note::
Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec`
Expand Down Expand Up @@ -601,23 +607,24 @@ state:
.. c:function:: int PyModule_AddIntConstant(PyObject *module, const char *name, long value)
Add an integer constant to *module* as *name*. This convenience function can be
used from the module's initialization function. Return ``-1`` on error, ``0`` on
success.
used from the module's initialization function.
Return ``-1`` with an exception set on error, ``0`` on success.
.. c:function:: int PyModule_AddStringConstant(PyObject *module, const char *name, const char *value)
Add a string constant to *module* as *name*. This convenience function can be
used from the module's initialization function. The string *value* must be
``NULL``-terminated. Return ``-1`` on error, ``0`` on success.
``NULL``-terminated.
Return ``-1`` with an exception set on error, ``0`` on success.
.. c:macro:: PyModule_AddIntMacro(module, macro)
Add an int constant to *module*. The name and the value are taken from
*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int
constant *AF_INET* with the value of *AF_INET* to *module*.
Return ``-1`` on error, ``0`` on success.
Return ``-1`` with an exception set on error, ``0`` on success.
.. c:macro:: PyModule_AddStringMacro(module, macro)
Expand All @@ -630,7 +637,7 @@ state:
The type object is finalized by calling internally :c:func:`PyType_Ready`.
The name of the type object is taken from the last component of
:c:member:`~PyTypeObject.tp_name` after dot.
Return ``-1`` on error, ``0`` on success.
Return ``-1`` with an exception set on error, ``0`` on success.
.. versionadded:: 3.9
Expand All @@ -643,7 +650,7 @@ state:
import machinery assumes the module does not support running without the
GIL. This function is only available in Python builds configured with
:option:`--disable-gil`.
Return ``-1`` on error, ``0`` on success.
Return ``-1`` with an exception set on error, ``0`` on success.
.. versionadded:: 3.13
Expand Down Expand Up @@ -682,14 +689,14 @@ since multiple such modules can be created from a single definition.
The caller must hold the GIL.
Return 0 on success or -1 on failure.
Return ``-1`` with an exception set on error, ``0`` on success.
.. versionadded:: 3.3
.. c:function:: int PyState_RemoveModule(PyModuleDef *def)
Removes the module object created from *def* from the interpreter state.
Return 0 on success or -1 on failure.
Return ``-1`` with an exception set on error, ``0`` on success.
The caller must hold the GIL.
Expand Down
1 change: 1 addition & 0 deletions Doc/c-api/object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Object Protocol
The reference is borrowed from the interpreter, and is valid until the
interpreter finalization.
.. versionadded:: 3.13
Expand Down
8 changes: 5 additions & 3 deletions Doc/c-api/slice.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ Slice Objects
Return a new slice object with the given values. The *start*, *stop*, and
*step* parameters are used as the values of the slice object attributes of
the same names. Any of the values may be ``NULL``, in which case the
``None`` will be used for the corresponding attribute. Return ``NULL`` if
``None`` will be used for the corresponding attribute.
Return ``NULL`` with an exception set if
the new object could not be allocated.
Expand Down Expand Up @@ -52,7 +54,7 @@ Slice Objects
of bounds indices are clipped in a manner consistent with the handling of
normal slices.
Returns ``0`` on success and ``-1`` on error with exception set.
Return ``0`` on success and ``-1`` on error with an exception set.
.. note::
This function is considered not safe for resizable sequences.
Expand Down Expand Up @@ -95,7 +97,7 @@ Slice Objects
``PY_SSIZE_T_MIN`` to ``PY_SSIZE_T_MIN``, and silently boost the step
values less than ``-PY_SSIZE_T_MAX`` to ``-PY_SSIZE_T_MAX``.
Return ``-1`` on error, ``0`` on success.
Return ``-1`` with an exception set on error, ``0`` on success.
.. versionadded:: 3.6.1
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/typeobj.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,7 @@ and :c:data:`PyType_Type` effectively act as defaults.)
weak references to the type object itself.

It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit and
:c:member:`~PyTypeObject.tp_weaklist`.
:c:member:`~PyTypeObject.tp_weaklistoffset`.

**Inheritance:**

Expand All @@ -1604,7 +1604,7 @@ and :c:data:`PyType_Type` effectively act as defaults.)
**Default:**

If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the
:c:member:`~PyTypeObject.tp_dict` field, then
:c:member:`~PyTypeObject.tp_flags` field, then
:c:member:`~PyTypeObject.tp_weaklistoffset` will be set to a negative value,
to indicate that it is unsafe to use this field.

Expand Down
3 changes: 3 additions & 0 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@
('c:data', 'PyExc_UnicodeWarning'),
('c:data', 'PyExc_UserWarning'),
('c:data', 'PyExc_Warning'),
# Undocumented public C macros
('c:macro', 'Py_BUILD_ASSERT'),
('c:macro', 'Py_BUILD_ASSERT_EXPR'),
# Do not error nit-picky mode builds when _SubParsersAction.add_parser cannot
# be resolved, as the method is currently undocumented. For context, see
# https://github.com/python/cpython/pull/103289.
Expand Down
40 changes: 40 additions & 0 deletions Doc/howto/logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,46 @@ following diagram.
.. raw:: html
:file: logging_flow.svg

.. raw:: html

<script>
/*
* This snippet is needed to handle the case where a light or dark theme is
* chosen via the theme is selected in the page. We call the existing handler
* and then add a dark-theme class to the body when the dark theme is selected.
* The SVG styling (above) then does the rest.
*
* If the pydoc theme is updated to set the dark-theme class, this snippet
* won't be needed any more.
*/
(function() {
var oldActivateTheme = activateTheme;
function updateBody(theme) {
let elem = document.body;
elem.classList.remove('dark-theme');
elem.classList.remove('light-theme');
if (theme === 'dark') {
elem.classList.add('dark-theme');
}
else if (theme === 'light') {
elem.classList.add('light-theme');
}
}
activateTheme = function(theme) {
oldActivateTheme(theme);
updateBody(theme);
};
/*
* If the page is refreshed, make sure we update the body - the overriding
* of activateTheme won't have taken effect yet.
*/
updateBody(localStorage.getItem('currentTheme') || 'auto');
})();
</script>

Loggers
^^^^^^^

Expand Down
Binary file modified Doc/howto/logging_flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 34 additions & 11 deletions Doc/howto/logging_flow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit cbd760e

Please sign in to comment.