Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into instr_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
iritkatriel committed Oct 21, 2023
2 parents 8ccbe6e + 7237fb5 commit d55f048
Show file tree
Hide file tree
Showing 1,051 changed files with 14,675 additions and 6,987 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ body:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "CPython main branch"
validations:
required: true
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ gmon.out
.coverage
.mypy_cache/
.pytest_cache/
.ruff_cache/
.DS_Store

*.exe
Expand Down
8 changes: 3 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
rev: v0.1.0
hooks:
- id: ruff
name: Run Ruff on Lib/test/
Expand All @@ -12,7 +12,7 @@ repos:
files: ^Tools/clinic/|Lib/test/test_clinic.py

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-toml
exclude: ^Lib/test/test_tomllib/
Expand All @@ -24,13 +24,11 @@ repos:
types_or: [c, inc, python, rst]

- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v0.6.8
rev: v0.8.1
hooks:
- id: sphinx-lint
args: [--enable=default-role]
files: ^Doc/|^Misc/NEWS.d/next/
types: [rst]
require_serial: true

- repo: meta
hooks:
Expand Down
9 changes: 7 additions & 2 deletions Doc/c-api/arg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,10 @@ API Functions
.. c:function:: int PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], ...)
Parse the parameters of a function that takes both positional and keyword
parameters into local variables. The *keywords* argument is a
``NULL``-terminated array of keyword parameter names. Empty names denote
parameters into local variables.
The *keywords* argument is a ``NULL``-terminated array of keyword parameter
names specified as null-terminated ASCII or UTF-8 encoded C strings.
Empty names denote
:ref:`positional-only parameters <positional-only_parameter>`.
Returns true on success; on failure, it returns false and raises the
appropriate exception.
Expand All @@ -426,6 +428,9 @@ API Functions
Added support for :ref:`positional-only parameters
<positional-only_parameter>`.
.. versionchanged:: 3.13
Added support for non-ASCII keyword parameter names.
.. c:function:: int PyArg_VaParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], va_list vargs)
Expand Down
21 changes: 18 additions & 3 deletions Doc/c-api/init_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ PyConfig
Set to ``1`` by the :envvar:`PYTHONDUMPREFS` environment variable.
Need a special build of Python with the ``Py_TRACE_REFS`` macro defined:
Needs a special build of Python with the ``Py_TRACE_REFS`` macro defined:
see the :option:`configure --with-trace-refs option <--with-trace-refs>`.
Default: ``0``.
Expand Down Expand Up @@ -1048,7 +1048,7 @@ PyConfig
Incremented by the :option:`-d` command line option. Set to the
:envvar:`PYTHONDEBUG` environment variable value.
Need a :ref:`debug build of Python <debug-build>` (the ``Py_DEBUG`` macro
Needs a :ref:`debug build of Python <debug-build>` (the ``Py_DEBUG`` macro
must be defined).
Default: ``0``.
Expand Down Expand Up @@ -1100,6 +1100,7 @@ PyConfig
Set by the :option:`-X pycache_prefix=PATH <-X>` command line option and
the :envvar:`PYTHONPYCACHEPREFIX` environment variable.
The command-line option takes precedence.
If ``NULL``, :data:`sys.pycache_prefix` is set to ``None``.
Expand Down Expand Up @@ -1143,13 +1144,27 @@ PyConfig
Default: ``NULL``.
.. c:member:: wchar_t* run_presite
``package.module`` path to module that should be imported before
``site.py`` is run.
Set by the :option:`-X presite=package.module <-X>` command-line
option and the :envvar:`PYTHON_PRESITE` environment variable.
The command-line option takes precedence.
Needs a :ref:`debug build of Python <debug-build>` (the ``Py_DEBUG`` macro
must be defined).
Default: ``NULL``.
.. c:member:: int show_ref_count
Show total reference count at exit (excluding immortal objects)?
Set to ``1`` by :option:`-X showrefcount <-X>` command line option.
Need a :ref:`debug build of Python <debug-build>` (the ``Py_REF_DEBUG``
Needs a :ref:`debug build of Python <debug-build>` (the ``Py_REF_DEBUG``
macro must be defined).
Default: ``0``.
Expand Down
3 changes: 2 additions & 1 deletion Doc/c-api/memory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,8 @@ The pymalloc allocator
Python has a *pymalloc* allocator optimized for small objects (smaller or equal
to 512 bytes) with a short lifetime. It uses memory mappings called "arenas"
with a fixed size of 256 KiB. It falls back to :c:func:`PyMem_RawMalloc` and
with a fixed size of either 256 KiB on 32-bit platforms or 1 MiB on 64-bit
platforms. It falls back to :c:func:`PyMem_RawMalloc` and
:c:func:`PyMem_RawRealloc` for allocations larger than 512 bytes.
*pymalloc* is the :ref:`default allocator <default-memory-allocators>` of the
Expand Down
4 changes: 3 additions & 1 deletion Doc/c-api/set.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,6 @@ subtypes but not for instances of :class:`frozenset` or its subtypes.
.. c:function:: int PySet_Clear(PyObject *set)
Empty an existing set of all elements.
Empty an existing set of all elements. Return ``0`` on
success. Return ``-1`` and raise :exc:`SystemError` if *set* is not an instance of
:class:`set` or its subtype.
6 changes: 5 additions & 1 deletion Doc/c-api/structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,11 @@ Accessing attributes of extension types
.. c:type:: PyMemberDef
Structure which describes an attribute of a type which corresponds to a C
struct member. Its fields are, in order:
struct member.
When defining a class, put a NULL-terminated array of these
structures in the :c:member:`~PyTypeObject.tp_members` slot.
Its fields are, in order:
.. c:member:: const char* name
Expand Down
41 changes: 27 additions & 14 deletions Doc/c-api/type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -461,21 +461,34 @@ The following functions and structs are used to create
* ``Py_nb_add`` to set :c:member:`PyNumberMethods.nb_add`
* ``Py_sq_length`` to set :c:member:`PySequenceMethods.sq_length`
The following fields cannot be set at all using :c:type:`PyType_Spec` and
:c:type:`PyType_Slot`:
* :c:member:`~PyTypeObject.tp_dict`
* :c:member:`~PyTypeObject.tp_mro`
* :c:member:`~PyTypeObject.tp_cache`
* :c:member:`~PyTypeObject.tp_subclasses`
* :c:member:`~PyTypeObject.tp_weaklist`
The following “offset” fields cannot be set using :c:type:`PyType_Slot`:
* :c:member:`~PyTypeObject.tp_weaklistoffset`
(use :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead if possible)
* :c:member:`~PyTypeObject.tp_dictoffset`
(use :c:macro:`Py_TPFLAGS_MANAGED_DICT` instead if possible)
* :c:member:`~PyTypeObject.tp_vectorcall_offset`
(use ``"__vectorcalloffset__"`` in
:ref:`PyMemberDef <pymemberdef-offsets>`)
If it is not possible to switch to a ``MANAGED`` flag (for example,
for vectorcall or to support Python older than 3.12), specify the
offset in :c:member:`Py_tp_members <PyTypeObject.tp_members>`.
See :ref:`PyMemberDef documentation <pymemberdef-offsets>`
for details.
The following fields cannot be set at all when creating a heap type:
* :c:member:`~PyTypeObject.tp_vectorcall`
* :c:member:`~PyTypeObject.tp_weaklistoffset`
(use :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead)
* :c:member:`~PyTypeObject.tp_dictoffset`
(use :c:macro:`Py_TPFLAGS_MANAGED_DICT` instead)
* :c:member:`~PyTypeObject.tp_vectorcall_offset`
(see :ref:`PyMemberDef <pymemberdef-offsets>`)
(use :c:member:`~PyTypeObject.tp_new` and/or
:c:member:`~PyTypeObject.tp_init`)
* Internal fields:
:c:member:`~PyTypeObject.tp_dict`,
:c:member:`~PyTypeObject.tp_mro`,
:c:member:`~PyTypeObject.tp_cache`,
:c:member:`~PyTypeObject.tp_subclasses`, and
:c:member:`~PyTypeObject.tp_weaklist`.
Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be
problematic on some platforms.
Expand Down
12 changes: 10 additions & 2 deletions Doc/c-api/unicode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -971,8 +971,8 @@ These are the UTF-8 codec APIs:
returned buffer always has an extra null byte appended (not included in
*size*), regardless of whether there are any other null code points.
In the case of an error, ``NULL`` is returned with an exception set and no
*size* is stored.
On error, set an exception, set *size* to ``-1`` (if it's not NULL) and
return ``NULL``.
This caches the UTF-8 representation of the string in the Unicode object, and
subsequent calls will return a pointer to the same buffer. The caller is not
Expand All @@ -992,11 +992,19 @@ These are the UTF-8 codec APIs:
As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size.
Raise an exception if the *unicode* string contains embedded null
characters. To accept embedded null characters and truncate on purpose
at the first null byte, ``PyUnicode_AsUTF8AndSize(unicode, NULL)`` can be
used instead.
.. versionadded:: 3.3
.. versionchanged:: 3.7
The return type is now ``const char *`` rather of ``char *``.
.. versionchanged:: 3.13
Raise an exception if the string contains embedded null characters.
UTF-32 Codecs
"""""""""""""
Expand Down
7 changes: 7 additions & 0 deletions Doc/data/stable_abi.dat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Doc/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ Glossary

context manager
An object which controls the environment seen in a :keyword:`with`
statement by defining :meth:`__enter__` and :meth:`__exit__` methods.
statement by defining :meth:`~object.__enter__` and :meth:`~object.__exit__` methods.
See :pep:`343`.

context variable
Expand Down Expand Up @@ -636,7 +636,7 @@ Glossary
iterables include all sequence types (such as :class:`list`, :class:`str`,
and :class:`tuple`) and some non-sequence types like :class:`dict`,
:term:`file objects <file object>`, and objects of any classes you define
with an :meth:`__iter__` method or with a :meth:`__getitem__` method
with an :meth:`__iter__` method or with a :meth:`~object.__getitem__` method
that implements :term:`sequence` semantics.

Iterables can be
Expand Down Expand Up @@ -1078,17 +1078,17 @@ Glossary

sequence
An :term:`iterable` which supports efficient element access using integer
indices via the :meth:`__getitem__` special method and defines a
indices via the :meth:`~object.__getitem__` special method and defines a
:meth:`__len__` method that returns the length of the sequence.
Some built-in sequence types are :class:`list`, :class:`str`,
:class:`tuple`, and :class:`bytes`. Note that :class:`dict` also
supports :meth:`__getitem__` and :meth:`__len__`, but is considered a
supports :meth:`~object.__getitem__` and :meth:`__len__`, but is considered a
mapping rather than a sequence because the lookups use arbitrary
:term:`immutable` keys rather than integers.

The :class:`collections.abc.Sequence` abstract base class
defines a much richer interface that goes beyond just
:meth:`__getitem__` and :meth:`__len__`, adding :meth:`count`,
:meth:`~object.__getitem__` and :meth:`__len__`, adding :meth:`count`,
:meth:`index`, :meth:`__contains__`, and
:meth:`__reversed__`. Types that implement this expanded
interface can be registered explicitly using
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/abc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ a helper class :class:`ABC` to alternatively define ABCs through inheritance:
Finally, the last line makes ``Foo`` a virtual subclass of ``MyIterable``,
even though it does not define an :meth:`~iterator.__iter__` method (it uses
the old-style iterable protocol, defined in terms of :meth:`__len__` and
:meth:`__getitem__`). Note that this will not make ``get_iterator``
:meth:`~object.__getitem__`). Note that this will not make ``get_iterator``
available as a method of ``Foo``, so it is provided separately.


Expand Down
16 changes: 12 additions & 4 deletions Doc/library/asyncio-eventloop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1686,13 +1686,13 @@ Event Loop Implementations
asyncio ships with two different event loop implementations:
:class:`SelectorEventLoop` and :class:`ProactorEventLoop`.

By default asyncio is configured to use :class:`SelectorEventLoop`
on Unix and :class:`ProactorEventLoop` on Windows.
By default asyncio is configured to use :class:`EventLoop`.


.. class:: SelectorEventLoop

An event loop based on the :mod:`selectors` module.
A subclass of :class:`AbstractEventLoop` based on the
:mod:`selectors` module.

Uses the most efficient *selector* available for the given
platform. It is also possible to manually configure the
Expand All @@ -1714,7 +1714,7 @@ on Unix and :class:`ProactorEventLoop` on Windows.

.. class:: ProactorEventLoop

An event loop for Windows that uses "I/O Completion Ports" (IOCP).
A subclass of :class:`AbstractEventLoop` for Windows that uses "I/O Completion Ports" (IOCP).

.. availability:: Windows.

Expand All @@ -1723,6 +1723,14 @@ on Unix and :class:`ProactorEventLoop` on Windows.
`MSDN documentation on I/O Completion Ports
<https://docs.microsoft.com/en-ca/windows/desktop/FileIO/i-o-completion-ports>`_.

.. class:: EventLoop

An alias to the most efficient available subclass of :class:`AbstractEventLoop` for the given
platform.

It is an alias to :class:`SelectorEventLoop` on Unix and :class:`ProactorEventLoop` on Windows.

.. versionadded:: 3.13

.. class:: AbstractEventLoop

Expand Down
2 changes: 2 additions & 0 deletions Doc/library/asyncio-runner.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ Running an asyncio Program
This function should be used as a main entry point for asyncio programs,
and should ideally only be called once. It is recommended to use
*loop_factory* to configure the event loop instead of policies.
Passing :class:`asyncio.EventLoop` allows running asyncio without the
policy system.

The executor is given a timeout duration of 5 minutes to shutdown.
If the executor hasn't finished within that duration, a warning is
Expand Down
6 changes: 3 additions & 3 deletions Doc/library/asyncio-task.rst
Original file line number Diff line number Diff line change
Expand Up @@ -767,9 +767,6 @@ Timeouts

If the wait is cancelled, the future *aw* is also cancelled.

.. versionchanged:: 3.10
Removed the *loop* parameter.

.. _asyncio_example_waitfor:

Example::
Expand Down Expand Up @@ -800,6 +797,9 @@ Timeouts
.. versionchanged:: 3.10
Removed the *loop* parameter.

.. versionchanged:: 3.11
Raises :exc:`TimeoutError` instead of :exc:`asyncio.TimeoutError`.


Waiting Primitives
==================
Expand Down
Loading

0 comments on commit d55f048

Please sign in to comment.