A new JIT compiler, the first no-GIL edition of Python, better errors and typing enhancement, and the removal of dead batteries are all part of Python 3.13.
Python 3.13ย has just been released. This article presents a rundown of the most significant new features in Python 3.13 and what they mean for Python developers.
Major new features in Python 3.13
Hereโs a rundown of the biggest new features in Python 3.13:
- The experimental JIT
- The no-GIL build of Python
- A new REPL
- Improved error messages
- Enhancements to Python types
- No more โdead batteriesโ
The experimental JIT
Python 3.11 introduced theย Specializing Adaptive Interpreter. When the interpreter detects that some operations predictably involve the same types, those operations are โspecialized.โ The generic bytecode used for that code is swapped with bytecode specific to working with those types, which delivers speed boosts of anywhere from 10% to 25% for those regions of the code.
Python 3.12 brought more specializations and other refinements to the interpreter. Now, Python 3.13 addsย new elementsย to the JIT that generate actual machine code at runtime, instead of just specialized bytecode. The resulting speedup isnโt much just yetโmaybe 5%โbut it paves the way for future optimizations that werenโt previously possible.
Right now, the JIT is considered experimentalโitโs not enabled by default, and can only be enabled by compiling CPython from source with certain flags. If in time it yields a significant performance boost (5% or more), and doesnโt impose a large management burden on the CPython team or Pythonโs users as a whole, itโll become a fully supported build option. Whether or not it will be enabled for official releases will still be up to the managers for a given platformโs CPython builds.
Pythonโs release cycle
Theย Python programming languageย releases new versions yearly, with a feature-locked beta release in the first half of the year and the final release toward the end of the year. Developers are encouraged to try out this latest version on non-production code, both to verify that it works with your programs and to get an idea of whether your code will benefit from the new feature sets and performance enhancements in this latest version.
The no-GIL โfree-threadedโ build of Python
The official term forย possible future versions of CPython with no Global Interpreter Lockย (or GIL) is โfree-threaded CPython.โ This CPython build allows threads to run fully in parallel, without mediation from the GIL. To that end, CPU-bound work that once only benefited from being run in multipleย processesย can run in multipleย threads.
Free-threaded CPython is also experimental. Itโs not enabled by default in the shipped builds, so it needs to be enabled at compile time. If future work with the free-threaded builds shows it can improve multithreaded performance without impacting single-threaded performance, itโll be promoted to a fully supported option. In time, the free-threaded build of CPython may become the default.
A new REPL
The REPL, or interactive interpreter, launches when you run Python from the command line without executing a program. Python 3.13โs REPL has enhancements to make it less stodgy and more like an actual editor:
- Output to the console now has color enabled by default. This enhancement provides richer error messages, for instance.
- You can open the interactiveย
pydocย help browser by pressing F1. - You can browse the command-line history with F2.
- You can paste large blocks of code more easily by pressing F3 to enable a special block-paste mode.
- You can just typeย
exitย orยquit, instead ofยexit()ย orยquit(), to leave the REPL.
Note that these improvements currently are only available on Linux and macOS. They are not available on Microsoft Windows, not even when using the new Windows Terminal console host.
Improved error messages
Error traces in Python have become more precise and detailed over the last two releases. Python 3.13 continues on that trajectory.
- If you attempt to import something that has the same name as the module currently in context, Python will provide a detailed error to that effect, and encourage you to rename the current module. This is a very frequent source of bugsโand not only for beginners. Itโs a common mistake to name a module after something in the standard library.
- If you pass a function an incorrect keyword argument, the error will suggest some possible correct arguments, based on whatโs available in the function being called.
- Where supported, error messages nowย use color in tracebacksย to make them easier to read.
Enhancements to Python types
Pythonโs type hinting system has expanded in functionality and utility with each new version. Version 3.13 adds three big new changes.
Type parameters support defaults
typing.TypeVar,ย typing.ParamSpec, andย typing.TypeVarTupleย all let youย define defaults to be usedย if no type is explicitly specified. For instance:
T = TypeVar("T", default=str)
In cases whereย Tย is not explicitly defined when used,ย strย is assumed to be the default.
typing.TypeIs for type narrowing
In Python generally, we can useย isinstance()ย to make decisions based on whether or not something is a given type.ย typing.TypeIsย lets us do the same thing in Pythonโs type hinting mechanisms. This way, functions used to validate whether or not something is a given type can be annotated to show they perform that narrowing behavior, rather than just a return type. This is useful as a way to add precise type checker coverage to those functions.
typing.ReadOnly for read-only annotation
Theย typing.TypedDictย type was created to annotate dictionaries with fixed types for the values associated with certain keys.ย typing.Readonlyย lets youย annotate specific values in a TypedDict as read-only. An example is a list that you can only append to or pop from, not replace with a string or other type.
No more โdead batteriesโ
Python 3.11 identified a slew of Python standard library modules that wereย obsolete and no longer being maintained. The plan was to mark them as deprecated for 3.11 and 3.12, and then remove them entirely in Python 3.13. As of now, those โdead batteriesโ (as theyโve been called) are now permanently removed.ย Many of the removed modules can be replacedย with third-party modules, or their functionality can be emulated using other standard library components.
Users can expectย more deprecations to comeย over the next three versions of Python, as well. Most are methods for various standard library components that are rarely used or undocumented.


