Skip to content

Commit

Permalink
Merge branch 'main' into pythongh-113258-windows-frozen-intdir
Browse files Browse the repository at this point in the history
  • Loading branch information
itamaro committed Dec 25, 2023
2 parents 8898241 + f7c5a7a commit 4cfe118
Show file tree
Hide file tree
Showing 157 changed files with 3,839 additions and 6,071 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ Programs/test_frozenmain.h generated
Python/Python-ast.c generated
Python/executor_cases.c.h generated
Python/generated_cases.c.h generated
Python/abstract_interp_cases.c.h generated
Python/opcode_targets.h generated
Python/stdlib_module_names.h generated
Tools/peg_generator/pegen/grammar_parser.py generated
Expand Down
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ Doc/c-api/stable.rst @encukou

**/*dataclasses* @ericvsmith

**/*ensurepip* @pfmoore @pradyunsg

**/*idlelib* @terryjreedy

**/*typing* @JelleZijlstra @AlexWaygood
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/collections.abc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ the required methods (unless those methods have been set to

class E:
def __iter__(self): ...
def __next__(next): ...
def __next__(self): ...

.. doctest::

Expand Down
4 changes: 3 additions & 1 deletion Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1799,6 +1799,8 @@ Other constructor:

Examples::

.. doctest::

>>> from datetime import time
>>> time.fromisoformat('04:23:01')
datetime.time(4, 23, 1)
Expand All @@ -1808,7 +1810,7 @@ Other constructor:
datetime.time(4, 23, 1)
>>> time.fromisoformat('04:23:01.000384')
datetime.time(4, 23, 1, 384)
>>> time.fromisoformat('04:23:01,000')
>>> time.fromisoformat('04:23:01,000384')
datetime.time(4, 23, 1, 384)
>>> time.fromisoformat('04:23:01+04:00')
datetime.time(4, 23, 1, tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))
Expand Down
7 changes: 7 additions & 0 deletions Doc/library/dbm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,13 @@ This module can be used with the "classic" ndbm interface or the GNU GDBM
compatibility interface. On Unix, the :program:`configure` script will attempt
to locate the appropriate header file to simplify building this module.

.. warning::

The ndbm library shipped as part of macOS has an undocumented limitation on the
size of values, which can result in corrupted database files
when storing values larger than this limit. Reading such corrupted files can
result in a hard crash (segmentation fault).

.. exception:: error

Raised on :mod:`dbm.ndbm`-specific errors, such as I/O errors. :exc:`KeyError` is raised
Expand Down
7 changes: 4 additions & 3 deletions Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1214,9 +1214,10 @@ iterations of the loop.
``super(cls, self).method()``, ``super(cls, self).attr``).

It pops three values from the stack (from top of stack down):
- ``self``: the first argument to the current method
- ``cls``: the class within which the current method was defined
- the global ``super``

* ``self``: the first argument to the current method
* ``cls``: the class within which the current method was defined
* the global ``super``

With respect to its argument, it works similarly to :opcode:`LOAD_ATTR`,
except that ``namei`` is shifted left by 2 bits instead of 1.
Expand Down
7 changes: 7 additions & 0 deletions Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1800,6 +1800,13 @@ are always available. They are listed here in alphabetical order.
the second argument is a type, ``issubclass(type2, type)`` must be true (this
is useful for classmethods).

When called directly within an ordinary method of a class, both arguments may
be omitted ("zero-argument :func:`!super`"). In this case, *type* will be the
enclosing class, and *obj* will be the first argument of the immediately
enclosing function (typically ``self``). (This means that zero-argument
:func:`!super` will not work as expected within nested functions, including
generator expressions, which implicitly create nested functions.)

There are two typical use cases for *super*. In a class hierarchy with
single inheritance, *super* can be used to refer to parent classes without
naming them explicitly, thus making the code more maintainable. This use
Expand Down
30 changes: 20 additions & 10 deletions Doc/library/importlib.metadata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,18 @@ group. Read `the setuptools docs
<https://setuptools.pypa.io/en/latest/userguide/entry_point.html>`_
for more information on entry points, their definition, and usage.

*Compatibility Note*

The "selectable" entry points were introduced in ``importlib_metadata``
3.6 and Python 3.10. Prior to those changes, ``entry_points`` accepted
no parameters and always returned a dictionary of entry points, keyed
by group. With ``importlib_metadata`` 5.0 and Python 3.12,
``entry_points`` always returns an ``EntryPoints`` object. See
`backports.entry_points_selectable <https://pypi.org/project/backports.entry-points-selectable>`_
for compatibility options.

.. versionchanged:: 3.12
The "selectable" entry points were introduced in ``importlib_metadata``
3.6 and Python 3.10. Prior to those changes, ``entry_points`` accepted
no parameters and always returned a dictionary of entry points, keyed
by group. With ``importlib_metadata`` 5.0 and Python 3.12,
``entry_points`` always returns an ``EntryPoints`` object. See
`backports.entry_points_selectable <https://pypi.org/project/backports.entry-points-selectable>`_
for compatibility options.

.. versionchanged:: 3.13
``EntryPoint`` objects no longer present a tuple-like interface
(:meth:`~object.__getitem__`).

.. _metadata:

Expand Down Expand Up @@ -342,9 +344,17 @@ instance::
>>> dist.metadata['License'] # doctest: +SKIP
'MIT'

For editable packages, an origin property may present :pep:`610`
metadata::

>>> dist.origin.url
'file:///path/to/wheel-0.32.3.editable-py3-none-any.whl'

The full set of available metadata is not described here.
See the `Core metadata specifications <https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata>`_ for additional details.

.. versionadded:: 3.13
The ``.origin`` property was added.

Distribution Discovery
======================
Expand Down
8 changes: 6 additions & 2 deletions Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1001,11 +1001,14 @@ as internal buffering of data.

.. audit-event:: os.chmod path,mode,dir_fd os.fchmod

.. availability:: Unix.
.. availability:: Unix, Windows.

The function is limited on Emscripten and WASI, see
:ref:`wasm-availability` for more information.

.. versionchanged:: 3.13
Added support on Windows.


.. function:: fchown(fd, uid, gid)

Expand Down Expand Up @@ -2077,7 +2080,8 @@ features:
Accepts a :term:`path-like object`.

.. versionchanged:: 3.13
Added support for the *follow_symlinks* argument on Windows.
Added support for a file descriptor and the *follow_symlinks* argument
on Windows.


.. function:: chown(path, uid, gid, *, dir_fd=None, follow_symlinks=True)
Expand Down
3 changes: 3 additions & 0 deletions Doc/library/shelve.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ Restrictions
differs across Unix versions and requires knowledge about the database
implementation used.

* On macOS :mod:`dbm.ndbm` can silently corrupt the database file on updates,
which can cause hard crashes when trying to read from the database.


.. class:: Shelf(dict, protocol=None, writeback=False, keyencoding='utf-8')

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/ssl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ probably additional platforms, as long as OpenSSL is installed on that platform.

Some behavior may be platform dependent, since calls are made to the
operating system socket APIs. The installed version of OpenSSL may also
cause variations in behavior. For example, TLSv1.3 with OpenSSL version
cause variations in behavior. For example, TLSv1.3 comes with OpenSSL version
1.1.1.

.. warning::
Expand Down
23 changes: 11 additions & 12 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2604,33 +2604,32 @@ Functions and decorators

.. function:: reveal_type(obj, /)

Reveal the inferred static type of an expression.
Ask a static type checker to reveal the inferred type of an expression.

When a static type checker encounters a call to this function,
it emits a diagnostic with the type of the argument. For example::
it emits a diagnostic with the inferred type of the argument. For example::

x: int = 1
reveal_type(x) # Revealed type is "builtins.int"

This can be useful when you want to debug how your type checker
handles a particular piece of code.

The function returns its argument unchanged, which allows using
it within an expression::
At runtime, this function prints the runtime type of its argument to
:data:`sys.stderr` and returns the argument unchanged (allowing the call to
be used within an expression)::

x = reveal_type(1) # Revealed type is "builtins.int"
x = reveal_type(1) # prints "Runtime type is int"
print(x) # prints "1"

Note that the runtime type may be different from (more or less specific
than) the type statically inferred by a type checker.

Most type checkers support ``reveal_type()`` anywhere, even if the
name is not imported from ``typing``. Importing the name from
``typing`` allows your code to run without runtime errors and
``typing``, however, allows your code to run without runtime errors and
communicates intent more clearly.

At runtime, this function prints the runtime type of its argument to stderr
and returns it unchanged::

x = reveal_type(1) # prints "Runtime type is int"
print(x) # prints "1"

.. versionadded:: 3.11

.. decorator:: dataclass_transform(*, eq_default=True, order_default=False, \
Expand Down
8 changes: 4 additions & 4 deletions Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2808,10 +2808,10 @@ through the object's keys; for sequences, it should iterate through the values.
.. method:: object.__getitem__(self, key)

Called to implement evaluation of ``self[key]``. For :term:`sequence` types,
the accepted keys should be integers and slice objects. Note that the
special interpretation of negative indexes (if the class wishes to emulate a
:term:`sequence` type) is up to the :meth:`__getitem__` method. If *key* is
of an inappropriate type, :exc:`TypeError` may be raised; if of a value
the accepted keys should be integers. Optionally, they may support
:class:`slice` objects as well. Negative index support is also optional.
If *key* is
of an inappropriate type, :exc:`TypeError` may be raised; if *key* is a value
outside the set of indexes for the sequence (after any special
interpretation of negative values), :exc:`IndexError` should be raised. For
:term:`mapping` types, if *key* is missing (not in the container),
Expand Down
8 changes: 8 additions & 0 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ os
``False`` on Windows.
(Contributed by Serhiy Storchaka in :gh:`59616`)

* Add support of :func:`os.fchmod` and a file descriptor
in :func:`os.chmod` on Windows.
(Contributed by Serhiy Storchaka in :gh:`113191`)

* :func:`os.posix_spawn` now accepts ``env=None``, which makes the newly spawned
process use the current process environment.
(Contributed by Jakub Kulik in :gh:`113119`.)
Expand Down Expand Up @@ -1001,6 +1005,10 @@ importlib
for migration advice.
(Contributed by Jason R. Coombs in :gh:`106532`.)

* Remove deprecated :meth:`~object.__getitem__` access for
:class:`!importlib.metadata.EntryPoint` objects.
(Contributed by Jason R. Coombs in :gh:`113175`.)

locale
------

Expand Down
4 changes: 3 additions & 1 deletion Include/cpython/pystate.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,11 @@ struct _ts {
// layout, optimization, and WASI runtime. Wasmtime can handle about 700
// recursions, sometimes less. 500 is a more conservative limit.
# define Py_C_RECURSION_LIMIT 500
#elif defined(__s390x__)
# define Py_C_RECURSION_LIMIT 1200
#else
// This value is duplicated in Lib/test/support/__init__.py
# define Py_C_RECURSION_LIMIT 1500
# define Py_C_RECURSION_LIMIT 8000
#endif


Expand Down
Loading

0 comments on commit 4cfe118

Please sign in to comment.