Skip to content

Commit 11f47db

Browse files
Merge branch 'main' into implement-119127-again
2 parents 38ee450 + ff5806c commit 11f47db

File tree

212 files changed

+8711
-5739
lines changed

Some content is hidden

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

212 files changed

+8711
-5739
lines changed

Diff for: Doc/c-api/dict.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Dictionary Objects
156156
157157
.. c:function:: int PyDict_GetItemStringRef(PyObject *p, const char *key, PyObject **result)
158158
159-
Similar than :c:func:`PyDict_GetItemRef`, but *key* is specified as a
159+
Similar to :c:func:`PyDict_GetItemRef`, but *key* is specified as a
160160
:c:expr:`const char*` UTF-8 encoded bytes string, rather than a
161161
:c:expr:`PyObject*`.
162162
@@ -206,7 +206,7 @@ Dictionary Objects
206206
``NULL``, and return ``0``.
207207
- On error, raise an exception and return ``-1``.
208208
209-
This is similar to :meth:`dict.pop`, but without the default value and
209+
Similar to :meth:`dict.pop`, but without the default value and
210210
not raising :exc:`KeyError` if the key missing.
211211
212212
.. versionadded:: 3.13

Diff for: Doc/c-api/long.rst

+11-4
Original file line numberDiff line numberDiff line change
@@ -405,14 +405,13 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
405405
406406
Passing zero to *n_bytes* will return the size of a buffer that would
407407
be large enough to hold the value. This may be larger than technically
408-
necessary, but not unreasonably so.
408+
necessary, but not unreasonably so. If *n_bytes=0*, *buffer* may be
409+
``NULL``.
409410
410411
.. note::
411412
412413
Passing *n_bytes=0* to this function is not an accurate way to determine
413-
the bit length of a value.
414-
415-
If *n_bytes=0*, *buffer* may be ``NULL``.
414+
the bit length of the value.
416415
417416
To get at the entire Python value of an unknown size, the function can be
418417
called twice: first to determine the buffer size, then to fill it::
@@ -462,6 +461,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
462461
.. c:macro:: Py_ASNATIVEBYTES_NATIVE_ENDIAN ``3``
463462
.. c:macro:: Py_ASNATIVEBYTES_UNSIGNED_BUFFER ``4``
464463
.. c:macro:: Py_ASNATIVEBYTES_REJECT_NEGATIVE ``8``
464+
.. c:macro:: Py_ASNATIVEBYTES_ALLOW_INDEX ``16``
465465
============================================= ======
466466
467467
Specifying ``Py_ASNATIVEBYTES_NATIVE_ENDIAN`` will override any other endian
@@ -483,6 +483,13 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
483483
provided there is enough space for at least one sign bit, regardless of
484484
whether ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` was specified.
485485
486+
If ``Py_ASNATIVEBYTES_ALLOW_INDEX`` is specified and a non-integer value is
487+
passed, its :meth:`~object.__index__` method will be called first. This may
488+
result in Python code executing and other threads being allowed to run, which
489+
could cause changes to other objects or values in use. When *flags* is
490+
``-1``, this option is not set, and non-integer values will raise
491+
:exc:`TypeError`.
492+
486493
.. note::
487494
488495
With the default *flags* (``-1``, or *UNSIGNED_BUFFER* without

Diff for: Doc/howto/logging.rst

+42-2
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,48 @@ Logging Flow
382382
The flow of log event information in loggers and handlers is illustrated in the
383383
following diagram.
384384

385-
.. image:: logging_flow.png
386-
:class: invert-in-dark-mode
385+
.. raw:: html
386+
:file: logging_flow.svg
387+
388+
.. raw:: html
389+
390+
<script>
391+
/*
392+
* This snippet is needed to handle the case where a light or dark theme is
393+
* chosen via the theme is selected in the page. We call the existing handler
394+
* and then add a dark-theme class to the body when the dark theme is selected.
395+
* The SVG styling (above) then does the rest.
396+
*
397+
* If the pydoc theme is updated to set the dark-theme class, this snippet
398+
* won't be needed any more.
399+
*/
400+
(function() {
401+
var oldActivateTheme = activateTheme;
402+
403+
function updateBody(theme) {
404+
let elem = document.body;
405+
406+
elem.classList.remove('dark-theme');
407+
elem.classList.remove('light-theme');
408+
if (theme === 'dark') {
409+
elem.classList.add('dark-theme');
410+
}
411+
else if (theme === 'light') {
412+
elem.classList.add('light-theme');
413+
}
414+
}
415+
416+
activateTheme = function(theme) {
417+
oldActivateTheme(theme);
418+
updateBody(theme);
419+
};
420+
/*
421+
* If the page is refreshed, make sure we update the body - the overriding
422+
* of activateTheme won't have taken effect yet.
423+
*/
424+
updateBody(localStorage.getItem('currentTheme') || 'auto');
425+
})();
426+
</script>
387427

388428
Loggers
389429
^^^^^^^

Diff for: Doc/howto/logging_flow.png

86.4 KB
Loading

0 commit comments

Comments
 (0)