Python 3.13 release
On October 7, 2024, a stable version of the Python 3.13 programming language was released with an experimental JIT compiler, an improved interactive interpreter based on PyPy, and an experimental free-threaded build mode. Support for this branch is planned for a year and a half. Then, for another three and a half years, Python 3.13 will receive patches to address the vulnerabilities.
According to OpenNET, the main changes and additions in Python 3.13:
• an experimental implementation of the JIT-compiler has been added, which allows you to achieve a significant increase in productivity. Added –enable-experimental-jit compilation option to enable JIT in CPython, which requires LLVM to be installed as an additional dependency. The machine code translation process in JIT is built using the Copy-and-Patch architecture, which uses LLVM to compile an object file in ELF format containing data about bytecode instructions and information about the necessary data replacement. JIT replaces bytecode instructions generated during program interpretation with their representation in machine code, randomly substituting data necessary for calculations (JIT copies ready-made templates of already compiled functions and substitutes necessary values, such as arguments and constants, into them);
• added experimental CPython compilation mode without global interpreter lock (GIL, Global Interpreter Lock), which is enabled using the –without-gil option and allows you to get rid of the problem of parallelization of operations on multi-core systems, caused by the fact that the global lock does not allow parallel access to separable objects from different streams. Disabling the GIL leads to additional overhead caused by changes in the garbage collector, memory management system, and primitives for organizing locks. For example, due to the use of link counting for thread isolation, the performance of single-threaded scenarios is reduced by about 10%. At the same time, such overheads can be compensated by parallelization of operations;
• a new and improved interactive interpreter is offered, based on the achievements of the PyPy project and supports such features as multi-line editing, saving and viewing history, color rendering of requests and traces, use of REPL-like commands (help, exit, quit) without involving functions, interactive help the mode of inserting large blocks of code;
• the semantics of the locals() builtin function, which returns all local variables and their values in the current scope, changed for optimized scopes such as functions, generators, and routines, which now return independent snapshots of currently exposed local variables and non-local variables variables reflected in circuits;
• By default, a modified version of the mimalloc library is included with Microsoft’s open memory allocation system, which demonstrates very high performance. The library is used when compiling without the GIL;
• the compiler cleaned leading gaps from each documenting line (docstring), which made it possible to reduce the memory consumed and reduce the size of the bytecode cache (*.pyc files);
• the dbm module implements the dbm.sqlite3 backend, which uses SQLite and is used by default when creating new files;
• implemented support for default indications in type parameters (typing.TypeVar, typing.ParamSpec and typing.TypeVarTuple). For example: ‘T = TypeVar(“T”, default=int)’;
• added a new typing.TypeIs instruction for specifying types, which is more intuitive than typing.TypeGuard;
• added the possibility of using the typing.ReadOnly instruction to mark TypeDicts elements available for reading only;
• added a new instruction warnings.deprecated() to indicate deprecated elements in the type system;
• the aifc, audioop, chunk, cgi, cgitb, crypt, imghdr, mailcap, msilib, nis, nntplib, ossaudiodev, pipes, sndhdr, spwd, sunau, telnetlib, uu, xdrlib and lib2to3 modules were removed from the standard library;
• the function copy.replace(); has been added to the copy module;
• the os module added functions for working with the timer through timerfd descriptors;
• a command line interface has been implemented for the random module;
• support for macOS versions from 10.9 to 10.12 has been discontinued;
• provided support for iOS and Android mobile platforms, which is assigned to the third level (Tier 3), where reliable assembly and maintenance of the platform is guaranteed by at least one key developer, but platform-related failures do not block the release and are not covered by SLA support ;
• support for the wasm32-wasi (WebAssembly System Interface) platform is moved to the second level, where failures block the release, and the changes causing them are fixed or canceled within 24 hours. Official support for the wasm32-emscripten platform has been discontinued.
In October 2023, the Python 3.12 programming language was released. This branch will be maintained for a year and a half after the release. Then for another three and a half years, fixes will be formed for it with the elimination of vulnerabilities.