deniz.in

Markets

Weather

Loading weather

· via dev.to (home feed)

Python 3.15.0 arrives with lazy imports, frozendict and UTF-8 by default

Python's yearly feature release lands a week late after a surprise third release candidate, adding lazy imports, frozendict, UTF-8 as the default encoding and JIT speedups.

Python 3.15.0 arrives with lazy imports, frozendict and UTF-8 by default

Python 3.15.0 lands after a bumpy final stretch

Python 3.15.0 went out on 9 October 2026 as the language's annual feature release. It arrived a week later than originally planned because an unplanned third release candidate was needed to fix late bugs in the new lazy-imports mechanism, according to Tech AI Wire's writeup on dev.to. The release aggregates 5,643 commits from 1,012 contributors, figures release manager Hugo van Kemenade shared on Python Insider.

The headline features

Each major change is anchored to a Python Enhancement Proposal (PEP):

  • PEP 810 introduces explicit lazy imports, letting programs postpone loading a module until it is actually used, which trims startup time.
  • PEP 814 adds frozendict, a built-in dictionary that cannot be modified after creation.
  • PEP 661 delivers a built-in Sentinel type for unique marker values.
  • PEP 686 makes UTF-8 the default text encoding unless code says otherwise.
  • PEP 798 permits unpacking inside comprehensions.
  • PEP 829 defines startup configuration files for packages.
  • PEP 799 adds the Tachyon sampling profiler as a package.
  • PEPs 803, 820 and 793 establish a free-threaded stable ABI, so one compiled extension can run across free-threaded builds.
  • PEP 831 turns on frame pointers by default in builds.

Typing gains three further changes under PEPs 728, 747 and 800, while the experimental JIT compiler, error messages and command-line colors also received attention, per the What's New documentation cited in the article.

The encoding shift

The UTF-8 change has the widest reach on Windows, Linux Compatible reports, because text handling there previously relied on a different default. Applications that depend on the older behavior can set PYTHONUTF8=0 to restore it, though the article frames that as a stopgap rather than a fix.

Faster, depending on the workload

The JIT, which compiles frequently executed Python code to machine code while the program runs, got faster. Python Insider's geometric-mean numbers show gains of 7-8% on x86-64 Linux against the standard interpreter and 11-12% on AArch64 macOS against the tail-calling interpreter. The spread is wide: individual benchmarks run from roughly 15% slower to more than 100% faster, Linux Compatible reports.

The official installers changed as well. Windows 64-bit builds now use the tail-calling interpreter, worth 15-20% by Linux Compatible's measure and up to 40% for small, long-running pure-Python scripts. macOS installers now ship free-threading by default, meaning Python can run code across multiple CPU cores without the global interpreter lock.

One warning for Mac users

On macOS 27.0, IDLE and other tkinter applications can hang when a menu command triggers a dialog box, leaving force quit as the only way out. The Python team attributes the problem to an operating-system change and says it affects every version of Tk, the toolkit behind tkinter. It is tracked as issue #158053, and the release page advises waiting on macOS 27.0 if you rely on Tk applications.

What is being retired

Three items are on the way out, according to the release notes and Linux Compatible: the pure-Python profile module is deprecated and will be removed in Python 3.17, with cProfile remaining; code-executing lines in .pth files are deprecated in favor of the new PEP 829 startup files; and the PyGILState_* C functions are soft-deprecated but not removed.

Python 3.15 receives two years of bug fixes, followed by security fixes until roughly October 2031, following the schedule in PEP 602 as reported by Linux Compatible.

Why it matters

Lazy imports change when module-level code runs, so any tool that depends on import-time side effects needs testing before adopting the feature, and command-line utilities with heavy imports stand to benefit most. The UTF-8 default makes text handling more predictable across platforms but can break Windows code that assumed the old encoding, so file I/O tests there are worthwhile. Free-threading appearing in default macOS installers signals where the language is heading, and the frozen dictionary type offers a safer container for fixed configuration. The deprecations give a clear migration window, and the standing advice applies: verify that key dependencies support 3.15 before upgrading production systems.

  • #python
  • #programming-languages
  • #open-source
  • #release
  • #performance

Related posts