Skip to content

Latest commit

 

History

History
1494 lines (1067 loc) · 33.7 KB

3.14.0a6.rst

File metadata and controls

1494 lines (1067 loc) · 33.7 KB

Ensure web browser is launched by :func:`webbrowser.open` on macOS, even for file:// URLs.

:source:`pylauncher <PC/launcher2.c>` correctly detects a BOM when searching for the shebang. Fix by Chris Eibl.

Make it possible to override default keywords in :program:`pygettext`.

Correctly reset msgctxt when compiling messages in :program:`msgfmt`.

Extend support for specifying custom keywords in :program:`pygettext`.

Add warning messages when pygettext unimplemented -a/--extract-all option is called.

Add support for translator comments in :program:`pygettext.py`.

The iOS testbed now correctly handles symlinks used as Python framework references.

Fix the keyword entry in the help output of :program:`pygettext`.

Multiple iOS testbed runners can now be started at the same time without introducing an ambiguity over simulator ownership.

The iOS testbed will now run successfully on a machine that has not previously run Xcode tests (such as CI configurations).

The tests of terminal colorization are no longer sensitive to the value of the TERM variable in the testing environment.

Fix a flaky test in test_repr_rlock that checks the representation of :class:`multiprocessing.RLock`.

Add unit tests for pyrepl.

Avoid unbounded buffering for :meth:`!tempfile.SpooledTemporaryFile.writelines`. Previously, disk spillover was only checked after the lines iterator had been exhausted. This is now done after each line is written.

Use monospace font from System Font Stack for cross-platform support in :class:`difflib.HtmlDiff`.

Improve performance of :attr:`uuid.UUID.hex` and :meth:`uuid.UUID.__str__ <object.__str__>`.

The behavior of PyConfig.use_system_logger was modified to be enabled by default on iOS. It remains disabled by default on macOS.

Supported completions for attributes of convenience variables in :mod:`pdb`.

Removed undocumented CLI python -m difflib. Use python -m doctest Lib/difflib.py -v instead. Patch by Semyon Moroz.

Removed undocumented -t and -v arguments of python -m pickle. Use python -m doctest Lib/pickle.py -v instead. Patch by Semyon Moroz.

Correct :func:`time.sleep` error message when an object that cannot be interpreted as an integer or float is provided.

Removed undocumented -t and -v arguments of python -m pickletools. Use python -m doctest Lib/pickletools.py -v instead. Patch by Semyon Moroz.

Fix issue with __contains__, values, and pseudo-members for :class:`enum.Flag`.

Fix pure-Python implementation of :func:`datetime.time.fromisoformat` to reject times with spaces in fractional part (for example, 12:34:56.400 +02:00), matching the C implementation. Patch by Michał Gorny.

Deleting :class:`gzip.GzipFile` before it is closed now emits a :exc:`ResourceWarning`.

Add validation for numeric response data in poplib.POP3.stat() method

Only apply locale to :ref:`calendar CLI <calendar-cli>` when set via --locale and not via LANG environment variable.

sys.ps1 and sys.ps2 are now restored after :func:`code.interact` call.

Remove dirs_exist_ok argument from :meth:`pathlib.Path.copy` and :meth:`~pathlib.Path.copy_into`. These methods are new in Python 3.14.

Remove .. index:: directives from the :mod:`uuid` module documentation. These directives previously created entries in the general index for :func:`~uuid.getnode` as well as the :func:`~uuid.uuid1`, :func:`~uuid.uuid3`, :func:`~uuid.uuid4`, :func:`~uuid.uuid5`, and :func:`~uuid.uuid8` constructor functions.

The zipapp module now calculates the list of files to be added to the archive before creating the archive. This avoids accidentally including the target when it is being created in the source directory.

Inline breakpoints like :func:`breakpoint` or :func:`pdb.set_trace` will always stop the program at calling frame, ignoring the skip pattern (if any).

<tab> at the beginning of the line in :mod:`pdb` multi-line input will fill in a 4-space indentation now, instead of inserting a \t character.

Ensure the path returned from :meth:`pathlib.Path.copy` or :meth:`~pathlib.Path.move` has fresh :attr:`~pathlib.Path.info`.

stdlib configparser will now attempt to validate that keys it writes will not result in file corruption (creating a file unable to be accurately parsed by a future read() call from the same parser). Attempting a corrupting write() will raise an InvalidWriteError.

Speed up :meth:`Path.copy <pathlib.Path.copy>` by making better use of :attr:`~pathlib.Path.info` internally.

Fix corner case for :func:`random.sample` allowing the counts parameter to specify an empty population. So now, sample([], 0, counts=[]) and sample('abc', k=0, counts=[0, 0, 0]) both give the same result as sample([], 0).

Executing quit command in :mod:`pdb` will raise :exc:`bdb.BdbQuit` when :mod:`pdb` is started from an interactive console using :func:`breakpoint` or :func:`pdb.set_trace`.

Make :mod:`datetime` subclass :meth:`~object.__repr__` consistent both implementations. Patch by Semyon Moroz.

Fix regression in traceback.print_last().

Make concurrent iterations over :class:`itertools.batched` safe under free-threading.

Support breakpoints for :mod:`zipimport` modules on :mod:`pdb`

Fix crash in :func:`pow` with only :class:`~decimal.Decimal` third argument.

Show explicit errors when required arguments of :mod:`pdb` commands are missing

Improve repr of :class:`functools.singledispatchmethod` methods and descriptors.

Apply type conversion consistently in :class:`pathlib.PurePath` and :class:`~pathlib.Path` methods can accept a path object as an argument, such as :meth:`~pathlib.PurePath.match` and :meth:`~pathlib.Path.rename`. The argument is now converted to path object if it lacks a :meth:`~pathlib.PurePath.with_segments` attribute, and not otherwise.

Reverts a change in the previous release attempting to make some stdlib imports used within the :mod:`subprocess` module lazy as this was causing errors during __del__ finalizers calling methods such as terminate, or kill, or send_signal.

Fixed failure to raise :exc:`TypeError` in :meth:`inspect.Signature.bind` for positional-only arguments provided by keyword when a variadic keyword argument (e.g. **kwargs) is present.

Fix reference leaks in :func:`!_hashlib.hmac_new` and :func:`!_hashlib.hmac_digest`. Patch by Bénédikt Tran.

Fix :meth:`!asyncio.AbstractEventloop.run_forever` when another loop is already running.

Fix bug where :func:`ast.parse` did not error on AST input which is not of the correct type, when called with optimize=False.

Forbid the use of colon (":") as a fractional component separator and other improvements to the consistency of error raising between the C and Python implementations of :meth:`datetime.time.fromisoformat` and :meth:`datetime.datetime.fromisoformat`. Patch by Semyon Moroz.

Using :func:`super` and __class__ :term:`closure variable` in user-defined methods of :class:`typing.NamedTuple` subclasses is now explicitly prohibited at runtime. Contributed by Bartosz Sławecki in :gh:`130082`.

Improve import time of :mod:`cmd` by lazy importing :mod:`inspect` and removing :mod:`string`. Patch by Semyon Moroz.

Fix :class:`gzip.GzipFile` raising an unraisable exception during garbage collection when referring to a temporary object by breaking the reference loop with :mod:`weakref`.

Remove broken :func:`functools.singledispatchmethod` caching introduced in :gh:`85160`. Achieve the same performance using different optimization.

Add support for shared :class:`set` to :class:`multiprocessing.managers.SyncManager` via :meth:`SyncManager.set() <multiprocessing.managers.SyncManager.set>`.

Update MIME types for .avi and .wav. Add MIME types for .docx, .pptx, .xlsx, .epub, .flac, .m4a, .odg, .odp, .ods, .odt, .oga, .ogg, .ogx and .weba. Patch by Hugo van Kemenade.

Support context manager protocol by :class:`contextvars.Token`. Patch by Andrew Svetlov.

Update the deprecation warning of :meth:`importlib.abc.Loader.load_module`.

:class:`configparser.ConfigParser`: do not write an empty unnamed section

Restore :meth:`configparser.ConfigParser.read` performance.

Fix :func:`unicodedata.normalize` to always return a built-in :class:`str` object when given an input of a :class:`str` subclass, regardless of whether the string is already normalized.

Execution of multiple statements in the new REPL now stops immediately upon the first exception encountered. Patch by Bartosz Sławecki.

Fix bug in :func:`traceback.walk_stack` called with None where it was skipping more frames than in prior versions. This bug fix also changes walk_stack to walk the stack in the frame where it was called rather than where it first gets used.

Add optional l2_cid and l2_bdaddr_type fields to :mod:`socket` BTPROTO_L2CAP sockaddr tuple.

Fix :func:`mimetypes.guess_type` to use default mapping for empty Content-Type in registry.

Eagerly write to buffers passed to :class:`gzip.GzipFile`'s :meth:`~io.BufferedIOBase.readinto` and :meth:`~io.BufferedIOBase.readinto1` implementations, avoiding unnecessary allocations. Patch by Chris Markiewicz.

Improve display of :class:`annotationlib.ForwardRef` object within :class:`inspect.Signature` representations. This also fixes a :exc:`NameError` that was raised when using :func:`dataclasses.dataclass` on classes with unresolvable forward references.

Add :meth:`concurrent.futures.ProcessPoolExecutor.terminate_workers` and :meth:`concurrent.futures.ProcessPoolExecutor.kill_workers` as ways to terminate or kill all living worker processes in the given pool. (Contributed by Charles Machalow in :gh:`130849`.)

Add protocols :class:`io.Reader` and :class:`io.Writer` as alternatives to :class:`typing.IO`, :class:`typing.TextIO`, and :class:`typing.BinaryIO`.

Added additional information into error messages in :mod:`datetime`, and made the messages more consistent between the C and Python implementations. Patch by Semyon Moroz.

Delay deprecated :meth:`zipimport.zipimporter.load_module` removal time to 3.15. Use :meth:`zipimport.zipimporter.exec_module` instead.

Add the optional buffersize parameter to :meth:`concurrent.futures.Executor.map` to limit the number of submitted tasks whose results have not yet been yielded. If the buffer is full, iteration over the iterables pauses until a result is yielded from the buffer.

Non-printing characters are now properly handled in the new REPL.

Turn on virtual terminal mode and enable bracketed paste in REPL on Windows console. (If the terminal does not support bracketed paste, enabling it does nothing.)

Add :func:`uuid.uuid7` for generating UUIDv7 objects as specified in RFC 9562. Patch by Bénédikt Tran.

Add :func:`uuid.uuid6` for generating UUIDv6 objects as specified in RFC 9562. Patch by Bénédikt Tran.

Increase io.DEFAULT_BUFFER_SIZE from 8k to 128k and adjust :func:`open` on platforms where :meth:`os.fstat` provides a st_blksize field (such as Linux) to use max(min(blocksize, 8 MiB), io.DEFAULT_BUFFER_SIZE) rather than always using the device block size. This should improve I/O performance. Patch by Romain Morotti.

Make :class:`types.UnionType` an alias for :class:`typing.Union`. Both int | str and Union[int, str] now create instances of the same type. Patch by Jelle Zijlstra.

Document the command-line for :mod:`mimetypes`. It now exits with 1 on failure instead of 0 and 2 on incorrect command-line parameters instead of 1. Also, errors are printed to stderr instead of stdout and their text is made tighter. Patch by Oleg Iarygin and Hugo van Kemenade.

Require Sphinx 8.2.0 or later to build the Python documentation. Patch by Adam Turner.

The wheel tags supported by each macOS universal SDK option are now documented.

C API: Document :c:func:`PyUnicode_RSplit`, :c:func:`PyUnicode_Partition` and :c:func:`PyUnicode_RPartition`.

Fix data race in :data:`sys.monitoring` instrumentation while registering callback.

Fix support of unicode characters on Windows in the new REPL.

Fix incorrect exception handling in _PyModule_IsPossiblyShadowing

:func:`sys.setprofile` and :func:`sys.settrace` will not generate a c_call event for INSTRUMENTED_CALL_FUNCTION_EX if the callable is a method with a C function wrapped, because we do not generate c_return event in such case.

Fix JIT crash on Windows on Arm. Patch by Diego Russo and Brandt Bucher.

Fix a crash in the :term:`free threading` build when constructing a :class:`code` object with :attr:`~codeobject.co_consts` that contains instances of types that are not otherwise generated by the bytecode compiler.

Ensure that both left and right branches have the same source for async for loops. Add these branches to the co_branches() iterator.

Fix memory leak in the :term:`free threaded <free threading>` build when resizing a shared list or dictionary from multiple short-lived threads.

Improve JIT understanding of integers in boolean context.

Fix PyRefTracer_DESTROY not being sent from :file:`Python/ceval.c` Py_DECREF().

Renumber :opcode:`RESUME` from 149 to 128.

Fix race conditions during runtime finalization that could lead to accessing freed memory.

Improve the experimental JIT's ability to narrow boolean values based on the results of truthiness tests.

Fix a bug that was causing UnicodeDecodeError or SystemError to be raised when using f-strings with lambda expressions with non-ASCII characters. Patch by Pablo Galindo

Make sure that the location of branch targets in match cases is in the body, not the pattern.

Add branch monitoring (BRANCH_LEFT and BRANCH_RIGHT events) for async for loops.

Fix possible crashes related to concurrent change and use of the :mod:`sys` module attributes.

INSTRUMENTED_CALL_KW will expand the method before monitoring to reflect the actual behavior more accurately.

Improve JIT's ability to optimize strings in boolean contexts.

Use actual stack limits (from :manpage:`pthread_getattr_np(3)`) for linux, and other systems with _GNU_SOURCE defined, when determining limits for C stack protection.

Fix a crash that occurs when calling :func:`locals` inside an inline comprehension that uses the same local variable as the outer frame scope where the variable is a free or cell var.

Fix two more :class:`bytearray` functions for :term:`free threading`.

Use tagged references (_PyStackRef) for the default build as well as for the free-threading build. This has a small negative performance impact short-term but will enable larger speedups in the future and significantly reduce maintenance costs by allowing a single implementation of tagged references in the future.

Fix two race conditions involving concurrent imports that could lead to spurious failures with :exc:`ModuleNotFoundError`.

Make :class:`bytearray` iterator safe under :term:`free threading`.

Use the more efficient "medium" code model for JIT-compiled code on supported platforms.

A build-details.json file is now install in the platform-independent standard library directory (PEP 739 implementation).

Fix location for SyntaxErrors of invalid escapes in the tokenizer. Patch by Pablo Galindo

Change C stack overflow protection to consider the amount of stack consumed, rather than a counter. This allows deeper recursion in many cases, but remains safe.

Improve the experimental JIT's handling of returns to unknown callers.

Fix data race in compile_template in :file:`sre.c`.

Fix a race condition in the :term:`free threading` build when repr(set) is called concurrently with set.clear().

The internal (evaluation) stack is now spilled to memory whenever execution escapes from the interpreter or JIT compiled code. This should have no observable effect in either Python or builtin extensions, but will allow various important optimizations in the future.

Clarify syntax error messages for conditional expressions when a statement is specified before an :keyword:`if` or after an :keyword:`else` keyword.

:meth:`bytes.fromhex` and :meth:`bytearray.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-like objects <bytes-like object>`.

Add fast path for medium-size integers in :c:func:`PyLong_FromSsize_t`. Patch by Chris Eibl.

Make the :type:`bytearray` safe under :term:`free threading`.

Fix a crash in :meth:`UnicodeError.__str__ <object.__str__>` when custom attributes implement :meth:`~object.__str__` with side-effects. Patch by Bénédikt Tran.

:class:`typing.TypeAliasType` now supports star unpacking.

from __future__ import barry_as_FLUFL now works in more contexts, including when it is used in files, with the -c flag, and in the REPL when there are multiple statements on the same line. Previously, it worked only on subsequent lines in the REPL, and when the appropriate flags were passed directly to :func:`compile`. Patch by Pablo Galindo.

Make concurrent iterations over the same :func:`enumerate` iterator safe under free-threading. See Strategy for Iterators in Free Threading.

Support underscore and comma as thousands separators in the fractional part for floating-point presentation types of the new-style string formatting (with :func:`format` or :ref:`f-strings`). Patch by Sergey B Kirpichev.

Fix specialization of generic aliases that are generic over a :class:`typing.ParamSpec` and have been specialized with a nested type variable.

Adapt :func:`reversed` for use in the free-theading build. The :func:`reversed` is still not thread-safe in the sense that concurrent iterations may see the same object, but they will not corrupt the interpreter state.

Fix the platform._sys_version() method when __DATE__ is undefined at buildtime by changing default buildtime datetime string to the UNIX epoch.

Improve syntax errors for incorrectly closed strings. Patch by Pablo Galindo

Fix :c:type:`PyCMethod` API: replace size_t nargs with Py_ssize_t nargs in :c:type:`PyCMethod`. Patch by Victor Stinner.

Add again :c:func:`PySequence_Fast` to the limited C API. Patch by Victor Stinner.

The following private functions are deprecated and planned for removal in Python 3.18:

The pythoncapi-compat project can be used to get these new public functions on Python 3.13 and older.

Patch by Victor Stinner.

Add a new p format parameter to :c:func:`Py_BuildValue` that allows to take a C integer and produce a Python :class:`bool` object. Patch by Pablo Galindo.

Use -flto=thin for faster build times using clang-cl on Windows. Patch by Chris Eibl.

Ensure that Python.h is included before stdbool.h unless pyconfig.h is included before or in some platform-specific contexts.

Building with PlatformToolset=ClangCL on Windows now supports PGO (profile guided optimization). Patch by Chris Eibl with invaluable support from Steve Dover.

Allow building the JIT with the tailcall interpreter.

Fix a bug where the tailcall interpreter was enabled when --without-tail-call-interp was provided to the configure script.

Don't redefine _Py_NO_SANITIZE_UNDEFINED when compiling with a recent GCC version and undefined sanitizer enabled.

#pragma-based linking with python3*.lib can now be switched off with :c:expr:`Py_NO_LINK_LIB`. Patch by Jean-Christophe Fillion-Robin.