February 10th, 2025

Python 3.14 Getting New Interpreter

Python 3.14 introduces deferred evaluation of annotations, a new Python Configuration C API, a tail call interpreter, improved error messages, and enhancements across various modules, while noting deprecated features.

Read original articleLink Icon
Python 3.14 Getting New Interpreter

Python 3.14 introduces several significant features and improvements over its predecessor, Python 3.13. Notable changes include PEP 649, which implements deferred evaluation of annotations, allowing annotations to be stored and evaluated only when necessary, enhancing performance and usability. PEP 741 introduces a new Python Configuration C API, streamlining the initialization process. Additionally, a new interpreter type based on tail calls has been added, potentially improving performance by 3% to 30% depending on the platform. The release also includes improved error messages for unpacking assignments and new modules like `annotationlib` for inspecting annotations. Other enhancements span various modules, including `argparse`, `ast`, and `datetime`, with optimizations in built-in functions and the introduction of new class methods. Deprecated features and those pending removal in future versions are also noted, ensuring developers are aware of upcoming changes. Overall, Python 3.14 aims to enhance performance, usability, and clarity in error reporting while introducing new capabilities for developers.

- Python 3.14 features deferred evaluation of annotations for better performance.

- A new Python Configuration C API simplifies the initialization process.

- A new interpreter type based on tail calls may improve performance significantly.

- Enhanced error messages and new modules like `annotationlib` are introduced.

- Several modules have been improved, and deprecated features are noted for future removal.

Link Icon 8 comments
By @haberman - 3 months
I blogged about this: https://blog.reverberate.org/2025/02/10/tail-call-updates.ht...

It uses a technique I published several years ago for writing fast interpreters with tail calls: https://blog.reverberate.org/2021/04/21/musttail-efficient-i...

There is also this tweet from the author: https://x.com/kenjin4096/status/1887935698906529903

By @madspindel - 3 months
> Preliminary numbers on our machines suggest anywhere from -3% to 30% faster Python code, and a geometric mean of 9-15% faster on pyperformance depending on platform and architecture.

Nice!

By @codr7 - 3 months
I get the feeling that Python is finally reaching the critical mass needed to significantly improve performance, good times.
By @ninetyninenine - 3 months
They didn’t add tail calls for the longest time because it blows the stack and makes it harder to debug when stepping through code. Maybe they should make a keyword in Python to explicitly enable tail call recursion when it’s needed.
By @theandrewbailey - 3 months
Pi-thon.