Skip to content

Commit

Permalink
Merge branch 'main' into add_com_method_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
junkmd authored Nov 22, 2024
2 parents 6c60512 + 3c770e3 commit f0d3ede
Show file tree
Hide file tree
Showing 502 changed files with 10,008 additions and 4,625 deletions.
18 changes: 16 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ configure* @erlend-aasland @corona10
Makefile.pre.in @erlend-aasland
Modules/Setup* @erlend-aasland

# argparse
**/*argparse* @savannahostrowski

# asyncio
**/*asyncio* @1st1 @asvetlov @kumaraditya303 @willingc

# Core
**/*context* @1st1
**/*genobject* @markshannon
**/*hamt* @1st1
**/*jit* @brandtbucher
**/*jit* @brandtbucher @savannahostrowski
Objects/set* @rhettinger
Objects/dict* @methane @markshannon
Objects/typevarobject.c @JelleZijlstra
Expand Down Expand Up @@ -78,6 +81,17 @@ Programs/_bootstrap_python.c @ericsnowcurrently
Programs/python.c @ericsnowcurrently
Tools/build/generate_global_objects.py @ericsnowcurrently

# Initialization
Doc/library/sys_path_init.rst @FFY00
Doc/c-api/init_config.rst @FFY00

# getpath
**/*getpath* @FFY00

# site
**/*site.py @FFY00
Doc/library/site.rst @FFY00

# Exceptions
Lib/test/test_except*.py @iritkatriel
Objects/exceptions.c @iritkatriel
Expand All @@ -94,7 +108,7 @@ Modules/_hacl/** @gpshead
**/*logging* @vsajip

# venv
**/*venv* @vsajip
**/*venv* @vsajip @FFY00

# Launcher
/PC/launcher.c @vsajip
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ jobs:
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
runs-on: ubuntu-24.04
container:
image: ghcr.io/python/autoconf:2024.10.16.11360930377
image: ghcr.io/python/autoconf:2024.11.11.11786316759
timeout-minutes: 60
needs: check_source
if: needs.check_source.outputs.run_tests == 'true'
steps:
- name: Install Git
run: |
apt install git -yq
apt update && apt install git -yq
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@v4
with:
Expand All @@ -76,7 +76,7 @@ jobs:
# Check for changes in regenerated files
if test -n "$changes"; then
echo "Generated files not up to date."
echo "Perhaps you forgot to run make regen-all or build.bat --regen. ;)"
echo "Perhaps you forgot to run make regen-configure ;)"
echo "configure files must be regenerated with a specific version of autoconf."
echo "$changes"
echo ""
Expand Down
2 changes: 1 addition & 1 deletion Doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ check: _ensure-pre-commit

.PHONY: serve
serve:
@echo "The serve target was removed, use htmlview instead (see bpo-36329)"
@echo "The serve target was removed, use htmllive instead (see gh-80510)"

# Targets for daily automated doc build
# By default, Sphinx only rebuilds pages where the page content has changed.
Expand Down
3 changes: 3 additions & 0 deletions Doc/c-api/init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,9 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
This function now calls the :c:member:`PyThreadState.on_delete` callback.
Previously, that happened in :c:func:`PyThreadState_Delete`.
.. versionchanged:: 3.13
The :c:member:`PyThreadState.on_delete` callback was removed.
.. c:function:: void PyThreadState_Delete(PyThreadState *tstate)
Expand Down
33 changes: 33 additions & 0 deletions Doc/c-api/long.rst
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,39 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
.. versionadded:: 3.14
.. c:function:: int PyLong_IsPositive(PyObject *obj)
Check if the integer object *obj* is positive (``obj > 0``).
If *obj* is an instance of :c:type:`PyLongObject` or its subtype,
return ``1`` when it's positive and ``0`` otherwise. Else set an
exception and return ``-1``.
.. versionadded:: 3.14
.. c:function:: int PyLong_IsNegative(PyObject *obj)
Check if the integer object *obj* is negative (``obj < 0``).
If *obj* is an instance of :c:type:`PyLongObject` or its subtype,
return ``1`` when it's negative and ``0`` otherwise. Else set an
exception and return ``-1``.
.. versionadded:: 3.14
.. c:function:: int PyLong_IsZero(PyObject *obj)
Check if the integer object *obj* is zero.
If *obj* is an instance of :c:type:`PyLongObject` or its subtype,
return ``1`` when it's zero and ``0`` otherwise. Else set an
exception and return ``-1``.
.. versionadded:: 3.14
.. c:function:: PyObject* PyLong_GetInfo(void)
On success, return a read only :term:`named tuple`, that holds
Expand Down
9 changes: 5 additions & 4 deletions Doc/c-api/marshal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ binary mode.

Numeric values are stored with the least significant byte first.

The module supports two versions of the data format: version 0 is the
historical version, version 1 shares interned strings in the file, and upon
unmarshalling. Version 2 uses a binary format for floating-point numbers.
``Py_MARSHAL_VERSION`` indicates the current file format (currently 2).
The module supports several versions of the data format; see
the :py:mod:`Python module documentation <marshal>` for details.

.. c:macro:: Py_MARSHAL_VERSION
The current format version. See :py:data:`marshal.version`.

.. c:function:: void PyMarshal_WriteLongToFile(long value, FILE *file, int version)
Expand Down
24 changes: 24 additions & 0 deletions Doc/c-api/object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -575,3 +575,27 @@ Object Protocol
has the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set.
.. versionadded:: 3.13
.. c:function:: int PyUnstable_Object_EnableDeferredRefcount(PyObject *obj)
Enable `deferred reference counting <https://peps.python.org/pep-0703/#deferred-reference-counting>`_ on *obj*,
if supported by the runtime. In the :term:`free-threaded <free threading>` build,
this allows the interpreter to avoid reference count adjustments to *obj*,
which may improve multi-threaded performance. The tradeoff is
that *obj* will only be deallocated by the tracing garbage collector.
This function returns ``1`` if deferred reference counting is enabled on *obj*
(including when it was enabled before the call),
and ``0`` if deferred reference counting is not supported or if the hint was
ignored by the runtime. This function is thread-safe, and cannot fail.
This function does nothing on builds with the :term:`GIL` enabled, which do
not support deferred reference counting. This also does nothing if *obj* is not
an object tracked by the garbage collector (see :func:`gc.is_tracked` and
:c:func:`PyObject_GC_IsTracked`).
This function is intended to be used soon after *obj* is created,
by the code that creates it.
.. versionadded:: 3.14
5 changes: 1 addition & 4 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,7 @@

# General substitutions.
project = 'Python'
if sphinx.version_info[:2] >= (8, 1):
copyright = "2001-%Y, Python Software Foundation"
else:
copyright = f"2001-{time.strftime('%Y')}, Python Software Foundation"
copyright = "2001 Python Software Foundation"

# We look for the Include/patchlevel.h file in the current Python source tree
# and replace the values accordingly.
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-2024 Python Software Foundation. All rights reserved.
Copyright © 2001 Python Software Foundation. All rights reserved.

Copyright © 2000 BeOpen.com. All rights reserved.

Expand Down
13 changes: 13 additions & 0 deletions Doc/data/refcounts.dat
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,19 @@ PyLong_FromUnsignedLong:unsignedlong:v::
PyLong_FromVoidPtr:PyObject*::+1:
PyLong_FromVoidPtr:void*:p::

PyLong_IsPositive:int:::
PyLong_IsPositive:PyObject*:obj:0:

PyLong_IsNegative:int:::
PyLong_IsNegative:PyObject*:obj:0:

PyLong_IsZero:int:::
PyLong_IsZero:PyObject*:obj:0:

PyLong_GetSign:int:::
PyLong_GetSign:PyObject*:v:0:
PyLong_GetSign:int*:sign::

PyMapping_Check:int:::
PyMapping_Check:PyObject*:o:0:

Expand Down
7 changes: 0 additions & 7 deletions Doc/deprecations/pending-removal-in-3.14.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
Pending removal in Python 3.14
------------------------------

* The import system:

* Setting :attr:`~module.__loader__` on a module while
failing to set :attr:`__spec__.loader <importlib.machinery.ModuleSpec.loader>`
is deprecated. In Python 3.14, :attr:`!__loader__` will cease to be set or
taken into consideration by the import system or the standard library.

* :mod:`argparse`: The *type*, *choices*, and *metavar* parameters
of :class:`!argparse.BooleanOptionalAction` are deprecated
and will be removed in 3.14.
Expand Down
7 changes: 7 additions & 0 deletions Doc/deprecations/pending-removal-in-3.16.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Pending removal in Python 3.16
------------------------------

* The import system:

* Setting :attr:`~module.__loader__` on a module while
failing to set :attr:`__spec__.loader <importlib.machinery.ModuleSpec.loader>`
is deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or
taken into consideration by the import system or the standard library.

* :mod:`array`:

* The ``'u'`` format code (:c:type:`wchar_t`)
Expand Down
4 changes: 0 additions & 4 deletions Doc/deprecations/pending-removal-in-future.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,6 @@ although there is currently no date scheduled for their removal.
* ``splitvalue()``
* ``to_bytes()``

* :mod:`urllib.request`: :class:`~urllib.request.URLopener` and
:class:`~urllib.request.FancyURLopener` style of invoking requests is
deprecated. Use newer :func:`~urllib.request.urlopen` functions and methods.

* :mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial
writes.

Expand Down
15 changes: 15 additions & 0 deletions Doc/library/aifc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
:mod:`!aifc` --- Read and write AIFF and AIFC files
===================================================

.. module:: aifc
:synopsis: Removed in 3.13.
:deprecated:

.. deprecated-removed:: 3.11 3.13

This module is no longer part of the Python standard library.
It was :ref:`removed in Python 3.13 <whatsnew313-pep594>` after
being deprecated in Python 3.11. The removal was decided in :pep:`594`.

The last version of Python that provided the :mod:`!aifc` module was
`Python 3.12 <https://docs.python.org/3.12/library/aifc.html>`_.
36 changes: 33 additions & 3 deletions Doc/library/argparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,8 @@ Only actions that consume command-line arguments (e.g. ``'store'``,

The recommended way to create a custom action is to extend :class:`Action`,
overriding the :meth:`!__call__` method and optionally the :meth:`!__init__` and
:meth:`!format_usage` methods.
:meth:`!format_usage` methods. You can also register custom actions using the
:meth:`~ArgumentParser.register` method and reference them by their registered name.

An example of a custom action::

Expand Down Expand Up @@ -1020,10 +1021,11 @@ necessary type-checking and type conversions to be performed.
If the type_ keyword is used with the default_ keyword, the type converter
is only applied if the default is a string.

The argument to ``type`` can be any callable that accepts a single string.
The argument to ``type`` can be a callable that accepts a single string or
the name of a registered type (see :meth:`~ArgumentParser.register`)
If the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or
:exc:`ValueError`, the exception is caught and a nicely formatted error
message is displayed. No other exception types are handled.
message is displayed. Other exception types are not handled.

Common built-in types and functions can be used as type converters:

Expand Down Expand Up @@ -2163,6 +2165,34 @@ Intermixed parsing
.. versionadded:: 3.7


Registering custom types or actions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. method:: ArgumentParser.register(registry_name, value, object)

Sometimes it's desirable to use a custom string in error messages to provide
more user-friendly output. In these cases, :meth:`!register` can be used to
register custom actions or types with a parser and allow you to reference the
type by their registered name instead of their callable name.

The :meth:`!register` method accepts three arguments - a *registry_name*,
specifying the internal registry where the object will be stored (e.g.,
``action``, ``type``), *value*, which is the key under which the object will
be registered, and object, the callable to be registered.

The following example shows how to register a custom type with a parser::

>>> import argparse
>>> parser = argparse.ArgumentParser()
>>> parser.register('type', 'hexadecimal integer', lambda s: int(s, 16))
>>> parser.add_argument('--foo', type='hexadecimal integer')
_StoreAction(option_strings=['--foo'], dest='foo', nargs=None, const=None, default=None, type='hexadecimal integer', choices=None, required=False, help=None, metavar=None, deprecated=False)
>>> parser.parse_args(['--foo', '0xFA'])
Namespace(foo=250)
>>> parser.parse_args(['--foo', '1.2'])
usage: PROG [-h] [--foo FOO]
PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'

Exceptions
----------

Expand Down
17 changes: 17 additions & 0 deletions Doc/library/asynchat.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
:mod:`!asynchat` --- Asynchronous socket command/response handler
=================================================================

.. module:: asynchat
:synopsis: Removed in 3.12.
:deprecated:

.. deprecated-removed:: 3.6 3.12

This module is no longer part of the Python standard library.
It was :ref:`removed in Python 3.12 <whatsnew312-removed>` after
being deprecated in Python 3.6. The removal was decided in :pep:`594`.

Applications should use the :mod:`asyncio` module instead.

The last version of Python that provided the :mod:`!asynchat` module was
`Python 3.11 <https://docs.python.org/3.11/library/asynchat.html>`_.
2 changes: 1 addition & 1 deletion Doc/library/asyncio-eventloop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1797,7 +1797,7 @@ By default asyncio is configured to use :class:`EventLoop`.
.. seealso::

`MSDN documentation on I/O Completion Ports
<https://docs.microsoft.com/en-ca/windows/desktop/FileIO/i-o-completion-ports>`_.
<https://learn.microsoft.com/windows/win32/fileio/i-o-completion-ports>`_.

.. class:: EventLoop

Expand Down
6 changes: 5 additions & 1 deletion Doc/library/asyncio-stream.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ and work with streams:
family=socket.AF_UNSPEC, \
flags=socket.AI_PASSIVE, sock=None, \
backlog=100, ssl=None, reuse_address=None, \
reuse_port=None, ssl_handshake_timeout=None, \
reuse_port=None, keep_alive=None, \
ssl_handshake_timeout=None, \
ssl_shutdown_timeout=None, start_serving=True)
Start a socket server.
Expand Down Expand Up @@ -128,6 +129,9 @@ and work with streams:
.. versionchanged:: 3.11
Added the *ssl_shutdown_timeout* parameter.

.. versionchanged:: 3.13
Added the *keep_alive* parameter.


.. rubric:: Unix Sockets

Expand Down
17 changes: 17 additions & 0 deletions Doc/library/asyncore.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
:mod:`!asyncore` --- Asynchronous socket handler
================================================

.. module:: asyncore
:synopsis: Removed in 3.12.
:deprecated:

.. deprecated-removed:: 3.6 3.12

This module is no longer part of the Python standard library.
It was :ref:`removed in Python 3.12 <whatsnew312-removed>` after
being deprecated in Python 3.6. The removal was decided in :pep:`594`.

Applications should use the :mod:`asyncio` module instead.

The last version of Python that provided the :mod:`!asyncore` module was
`Python 3.11 <https://docs.python.org/3.11/library/asyncore.html>`_.
Loading

0 comments on commit f0d3ede

Please sign in to comment.