Skip to content

Commit

Permalink
Pull in main
Browse files Browse the repository at this point in the history
  • Loading branch information
erlend-aasland committed Jan 18, 2024
2 parents 0bb47dc + 6f4b242 commit ecafe1e
Show file tree
Hide file tree
Showing 429 changed files with 6,065 additions and 1,821 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ jobs:
uses: hendrikmuhs/[email protected]
with:
save: ${{ github.event_name == 'push' }}
max-size: "200M"
- name: Configure CPython
run: ./configure --config-cache --with-address-sanitizer --without-pymalloc
- name: Build CPython
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build_msi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
strategy:
matrix:
type: [x86, x64, arm64]
env:
IncludeFreethreaded: true
steps:
- uses: actions/checkout@v4
- name: Build CPython installer
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Display build info
run: .\python.bat -m test.pythoninfo
- name: Tests
run: .\PCbuild\rt.bat -p Win32 -d -q --fast-ci
run: .\PCbuild\rt.bat -p Win32 -d -q --fast-ci ${{ inputs.free-threading && '--disable-gil' || '' }}

build_win_amd64:
name: 'build and test (x64)'
Expand All @@ -37,7 +37,7 @@ jobs:
- name: Display build info
run: .\python.bat -m test.pythoninfo
- name: Tests
run: .\PCbuild\rt.bat -p x64 -d -q --fast-ci
run: .\PCbuild\rt.bat -p x64 -d -q --fast-ci ${{ inputs.free-threading && '--disable-gil' || '' }}

build_win_arm64:
name: 'build (arm64)'
Expand Down
18 changes: 18 additions & 0 deletions Doc/c-api/complex.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,29 @@ Complex Numbers as Python Objects
Return the real part of *op* as a C :c:expr:`double`.
If *op* is not a Python complex number object but has a
:meth:`~object.__complex__` method, this method will first be called to
convert *op* to a Python complex number object. If :meth:`!__complex__` is
not defined then it falls back to call :c:func:`PyFloat_AsDouble` and
returns its result. Upon failure, this method returns ``-1.0``, so one
should call :c:func:`PyErr_Occurred` to check for errors.
.. versionchanged:: 3.13
Use :meth:`~object.__complex__` if available.
.. c:function:: double PyComplex_ImagAsDouble(PyObject *op)
Return the imaginary part of *op* as a C :c:expr:`double`.
If *op* is not a Python complex number object but has a
:meth:`~object.__complex__` method, this method will first be called to
convert *op* to a Python complex number object. If :meth:`!__complex__` is
not defined then it falls back to call :c:func:`PyFloat_AsDouble` and
returns ``0.0`` on success. Upon failure, this method returns ``-1.0``, so
one should call :c:func:`PyErr_Occurred` to check for errors.
.. versionchanged:: 3.13
Use :meth:`~object.__complex__` if available.
.. c:function:: Py_complex PyComplex_AsCComplex(PyObject *op)
Expand Down
34 changes: 34 additions & 0 deletions Doc/c-api/structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,40 @@ definition with the same method name.
slot. This is helpful because calls to PyCFunctions are optimized more
than wrapper object calls.
.. c:function:: PyObject * PyCMethod_New(PyMethodDef *ml, PyObject *self, PyObject *module, PyTypeObject *cls)
Turn *ml* into a Python :term:`callable` object.
The caller must ensure that *ml* outlives the :term:`callable`.
Typically, *ml* is defined as a static variable.
The *self* parameter will be passed as the *self* argument
to the C function in ``ml->ml_meth`` when invoked.
*self* can be ``NULL``.
The :term:`callable` object's ``__module__`` attribute
can be set from the given *module* argument.
*module* should be a Python string,
which will be used as name of the module the function is defined in.
If unavailable, it can be set to :const:`None` or ``NULL``.
.. seealso:: :attr:`function.__module__`
The *cls* parameter will be passed as the *defining_class*
argument to the C function.
Must be set if :c:macro:`METH_METHOD` is set on ``ml->ml_flags``.
.. versionadded:: 3.9
.. c:function:: PyObject * PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module)
Equivalent to ``PyCMethod_New(ml, self, module, NULL)``.
.. c:function:: PyObject * PyCFunction_New(PyMethodDef *ml, PyObject *self)
Equivalent to ``PyCMethod_New(ml, self, NULL, NULL)``.
Accessing attributes of extension types
---------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion Doc/copyright.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Copyright

Python and this documentation is:

Copyright © 2001-2023 Python Software Foundation. All rights reserved.
Copyright © 2001-2024 Python Software Foundation. All rights reserved.

Copyright © 2000 BeOpen.com. All rights reserved.

Expand Down
15 changes: 15 additions & 0 deletions Doc/data/refcounts.dat
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,21 @@ PyContextVar_Reset:int:::
PyContextVar_Reset:PyObject*:var:0:
PyContextVar_Reset:PyObject*:token:-1:

PyCFunction_New:PyObject*::+1:
PyCFunction_New:PyMethodDef*:ml::
PyCFunction_New:PyObject*:self:+1:

PyCFunction_NewEx:PyObject*::+1:
PyCFunction_NewEx:PyMethodDef*:ml::
PyCFunction_NewEx:PyObject*:self:+1:
PyCFunction_NewEx:PyObject*:module:+1:

PyCMethod_New:PyObject*::+1:
PyCMethod_New:PyMethodDef*:ml::
PyCMethod_New:PyObject*:self:+1:
PyCMethod_New:PyObject*:module:+1:
PyCMethod_New:PyObject*:cls:+1:

PyDate_Check:int:::
PyDate_Check:PyObject*:ob:0:

Expand Down
10 changes: 5 additions & 5 deletions Doc/library/concurrent.futures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,22 @@ Executor Objects
future = executor.submit(pow, 323, 1235)
print(future.result())

.. method:: map(func, *iterables, timeout=None, chunksize=1)
.. method:: map(fn, *iterables, timeout=None, chunksize=1)

Similar to :func:`map(func, *iterables) <map>` except:
Similar to :func:`map(fn, *iterables) <map>` except:

* the *iterables* are collected immediately rather than lazily;

* *func* is executed asynchronously and several calls to
*func* may be made concurrently.
* *fn* is executed asynchronously and several calls to
*fn* may be made concurrently.

The returned iterator raises a :exc:`TimeoutError`
if :meth:`~iterator.__next__` is called and the result isn't available
after *timeout* seconds from the original call to :meth:`Executor.map`.
*timeout* can be an int or a float. If *timeout* is not specified or
``None``, there is no limit to the wait time.

If a *func* call raises an exception, then that exception will be
If a *fn* call raises an exception, then that exception will be
raised when its value is retrieved from the iterator.

When using :class:`ProcessPoolExecutor`, this method chops *iterables*
Expand Down
6 changes: 3 additions & 3 deletions Doc/library/dataclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -536,10 +536,10 @@ class :meth:`~object.__init__` methods. If the base class has an :meth:`~object.
that has to be called, it is common to call this method in a
:meth:`__post_init__` method::

@dataclass
class Rectangle:
height: float
width: float
def __init__(self, height, width):
self.height = height
self.width = width

@dataclass
class Square(Rectangle):
Expand Down
6 changes: 3 additions & 3 deletions Doc/library/email.message.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ over the object tree.
The :class:`EmailMessage` dictionary-like interface is indexed by the header
names, which must be ASCII values. The values of the dictionary are strings
with some extra methods. Headers are stored and returned in case-preserving
form, but field names are matched case-insensitively. Unlike a real dict,
there is an ordering to the keys, and there can be duplicate keys. Additional
methods are provided for working with headers that have duplicate keys.
form, but field names are matched case-insensitively. The keys are ordered,
but unlike a real dict, there can be duplicates. Addtional methods are
provided for working with headers that have duplicate keys.

The *payload* is either a string or bytes object, in the case of simple message
objects, or a list of :class:`EmailMessage` objects, for MIME container
Expand Down
26 changes: 14 additions & 12 deletions Doc/library/fnmatch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ Also note that :func:`functools.lru_cache` with the *maxsize* of 32768 is used t
cache the compiled regex patterns in the following functions: :func:`fnmatch`,
:func:`fnmatchcase`, :func:`.filter`.

.. function:: fnmatch(filename, pattern)
.. function:: fnmatch(name, pat)

Test whether the *filename* string matches the *pattern* string, returning
:const:`True` or :const:`False`. Both parameters are case-normalized
Test whether the filename string *name* matches the pattern string *pat*,
returning ``True`` or ``False``. Both parameters are case-normalized
using :func:`os.path.normcase`. :func:`fnmatchcase` can be used to perform a
case-sensitive comparison, regardless of whether that's standard for the
operating system.
Expand All @@ -69,22 +69,24 @@ cache the compiled regex patterns in the following functions: :func:`fnmatch`,
print(file)


.. function:: fnmatchcase(filename, pattern)
.. function:: fnmatchcase(name, pat)

Test whether *filename* matches *pattern*, returning :const:`True` or
:const:`False`; the comparison is case-sensitive and does not apply
:func:`os.path.normcase`.
Test whether the filename string *name* matches the pattern string *pat*,
returning ``True`` or ``False``;
the comparison is case-sensitive and does not apply :func:`os.path.normcase`.


.. function:: filter(names, pattern)
.. function:: filter(names, pat)

Construct a list from those elements of the iterable *names* that match *pattern*. It is the same as
``[n for n in names if fnmatch(n, pattern)]``, but implemented more efficiently.
Construct a list from those elements of the :term:`iterable` *names*
that match pattern *pat*.
It is the same as ``[n for n in names if fnmatch(n, pat)]``,
but implemented more efficiently.


.. function:: translate(pattern)
.. function:: translate(pat)

Return the shell-style *pattern* converted to a regular expression for
Return the shell-style pattern *pat* converted to a regular expression for
using with :func:`re.match`.

Example:
Expand Down
9 changes: 4 additions & 5 deletions Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -668,16 +668,15 @@ are always available. They are listed here in alphabetical order.
sign: "+" | "-"
infinity: "Infinity" | "inf"
nan: "nan"
digitpart: `!digit` (["_"] `!digit`)*
digit: <a Unicode decimal digit, i.e. characters in Unicode general category Nd>
digitpart: `digit` (["_"] `digit`)*
number: [`digitpart`] "." `digitpart` | `digitpart` ["."]
exponent: ("e" | "E") ["+" | "-"] `digitpart`
floatnumber: number [`exponent`]
floatvalue: [`sign`] (`floatnumber` | `infinity` | `nan`)

Here ``digit`` is a Unicode decimal digit (character in the Unicode general
category ``Nd``). Case is not significant, so, for example, "inf", "Inf",
"INFINITY", and "iNfINity" are all acceptable spellings for positive
infinity.
Case is not significant, so, for example, "inf", "Inf", "INFINITY", and
"iNfINity" are all acceptable spellings for positive infinity.

Otherwise, if the argument is an integer or a floating point number, a
floating point number with the same value (within Python's floating point
Expand Down
68 changes: 27 additions & 41 deletions Doc/library/idle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ IDLE is Python's Integrated Development and Learning Environment.

IDLE has the following features:

* coded in 100% pure Python, using the :mod:`tkinter` GUI toolkit

* cross-platform: works mostly the same on Windows, Unix, and macOS

* Python shell window (interactive interpreter) with colorizing
Expand Down Expand Up @@ -422,41 +420,34 @@ and that other files do not. Run Python code with the Run menu.
Key bindings
^^^^^^^^^^^^

In this section, 'C' refers to the :kbd:`Control` key on Windows and Unix and
the :kbd:`Command` key on macOS.

* :kbd:`Backspace` deletes to the left; :kbd:`Del` deletes to the right

* :kbd:`C-Backspace` delete word left; :kbd:`C-Del` delete word to the right

* Arrow keys and :kbd:`Page Up`/:kbd:`Page Down` to move around

* :kbd:`C-LeftArrow` and :kbd:`C-RightArrow` moves by words
The IDLE insertion cursor is a thin vertical bar between character
positions. When characters are entered, the insertion cursor and
everything to its right moves right one character and
the new character is entered in the new space.

* :kbd:`Home`/:kbd:`End` go to begin/end of line
Several non-character keys move the cursor and possibly
delete characters. Deletion does not puts text on the clipboard,
but IDLE has an undo list. Wherever this doc discusses keys,
'C' refers to the :kbd:`Control` key on Windows and
Unix and the :kbd:`Command` key on macOS. (And all such dicussions
assume that the keys have not been re-bound to something else.)

* :kbd:`C-Home`/:kbd:`C-End` go to begin/end of file
* Arrow keys move the cursor one character or line.

* Some useful Emacs bindings are inherited from Tcl/Tk:
* :kbd:`C-LeftArrow` and :kbd:`C-RightArrow` moves left or right one word.

* :kbd:`C-a` beginning of line
* :kbd:`Home` and :kbd:`End` go to the beginning or end of the line.

* :kbd:`C-e` end of line
* :kbd:`Page Up` and :kbd:`Page Down` go up or down one screen.

* :kbd:`C-k` kill line (but doesn't put it in clipboard)
* :kbd:`C-Home` and :kbd:`C-End` go to beginning or end of the file.

* :kbd:`C-l` center window around the insertion point
* :kbd:`Backspace` and :kbd:`Del` (or :kbd:`C-d`) delete the previous
or next character.

* :kbd:`C-b` go backward one character without deleting (usually you can
also use the cursor key for this)
* :kbd:`C-Backspace` and :kbd:`C-Del` delete one word left or right.

* :kbd:`C-f` go forward one character without deleting (usually you can
also use the cursor key for this)

* :kbd:`C-p` go up one line (usually you can also use the cursor key for
this)

* :kbd:`C-d` delete next character
* :kbd:`C-k` deletes ('kills') everything to the right.

Standard keybindings (like :kbd:`C-c` to copy and :kbd:`C-v` to paste)
may work. Keybindings are selected in the Configure IDLE dialog.
Expand Down Expand Up @@ -611,23 +602,18 @@ when one requests a restart on the Shell menu, or when one runs code
in an editor window.

The editing features described in previous subsections work when entering
code interactively. IDLE's Shell window also responds to the following keys.

* :kbd:`C-c` interrupts executing command

* :kbd:`C-d` sends end-of-file; closes window if typed at a ``>>>`` prompt

* :kbd:`Alt-/` (Expand word) is also useful to reduce typing
code interactively. IDLE's Shell window also responds to the following:

Command history
* :kbd:`C-c` attemps to interrupt statement execution (but may fail).

* :kbd:`Alt-p` retrieves previous command matching what you have typed. On
macOS use :kbd:`C-p`.
* :kbd:`C-d` closes Shell if typed at a ``>>>`` prompt.

* :kbd:`Alt-n` retrieves next. On macOS use :kbd:`C-n`.
* :kbd:`Alt-p` and :kbd:`Alt-n` (:kbd:`C-p` and :kbd:`C-n` on macOS)
retrieve to the current prompt the previous or next previously
entered statement that matches anything already typed.

* :kbd:`Return` while the cursor is on any previous command
retrieves that command
* :kbd:`Return` while the cursor is on any previous statement
appends the latter to anything already typed at the prompt.

Text colors
^^^^^^^^^^^
Expand Down
Loading

0 comments on commit ecafe1e

Please sign in to comment.