Python 3.9.13 现已发布,这是 Python 3.9 的第 13 个也是最后一个常规维护版本,包含了 166 次 commit。公告指出,从现在开始,3.9 分支将只接受安全修复,并且在 2025 年 10 月之前,这些修复程序将以仅源码的形式发布。

与 3.8 相比,Python 3.9 中的一些新的主要新特性和变化有:

PEP 573,C 扩展方法中的模块状态访问
PEP 584 , dict 中的 Union Operators
PEP 585 , 标准集合中的类型提示泛型
PEP 593 , 灵活的函数和变量注释
PEP 602 , Python 采用稳定的年度发布节奏
PEP 614 , 放宽 Decorators 的语法限制
PEP 615 , 标准库中对 IANA 时区数据库的支持
PEP 616,删除前缀和后缀的字符串方法
PEP 617 , 用于 CPython 的新 PEG 解析器
BPO 38379,garbage collection 不会阻塞 resurrected objects;
BPO 38692, os.pidfd_open 添加了允许在没有 races 和 signals 的情况下管理进程;
BPO 39926,Unicode 支持更新到版本 13.0.0;
BPO 1635741,当 Python 在同一进程中多次初始化时,它不再泄漏内存;
现在使用 PEP 590 vectorcall 加速了许多 Python 内置函数(range、tuple、set、frozenset、list、dict)
许多 Python 模块(_abc、audioop、_bz2、_codecs、_contextvars、_crypt、_functools、_json、_locale、operator、resource、time、_weakref)现在使用 PEP 489 定义的多阶段初始化;
许多标准库模块(audioop、ast、grp、_hashlib、pwd、_posixsubprocess、random、select、struct、termios、zlib)现在正在使用 PEP 384 定义的稳定 ABI。


Python 3.9.13 has now been released, the 13th and final regular maintenance release of Python 3.9 with 166 commits. The announcement states that from now on, the 3.9 branch will receive only security fixes, and that these fixes will be released in source-only form until October 2025.

Some of the new major new features and changes in Python 3.9 compared to 3.8 are:

PEP 573, Module State Access in C Extension Methods
PEP 584, Union Operators in dict
PEP 585, Type Hint Generics in Standard Collections
PEP 593, Flexible Function and Variable Annotations
PEP 602, Python adopts a steady annual release cadence
PEP 614, Relaxing syntax restrictions on Decorators
PEP 615 , Support for the IANA Time Zone Database in the Standard Library
PEP 616, String method for removing prefixes and suffixes
PEP 617, a new PEG parser for CPython
BPO 38379, garbage collection does not block resurrected objects;
BPO 38692, os.pidfd_open was added to allow managing processes without races and signals;
BPO 39926, Unicode support updated to version 13.0.0;
BPO 1635741, Python no longer leaks memory when it is initialized multiple times in the same process;
Many Python built-in functions (range, tuple, set, frozenset, list, dict) are now accelerated using PEP 590 vectorcall
Many Python modules (_abc, audioop, _bz2, _codecs, _contextvars, _crypt, _functools, _json, _locale, operator, resource, time, _weakref) now use multi-phase initialization as defined by PEP 489;
Many standard library modules (audioop, ast, grp, _hashlib, pwd, _posixsubprocess, random, select, struct, termios, zlib) are now using the stable ABI defined by PEP 384.

Details can be found in the announcement.