计划在 Python 3.20 中移除¶
调用
struct.Struct的__new__()方法不带 format 参数的做法已被弃用并将在 Python 3.20 中移除。 在已初始化的Struct对象上调用__init__()方法的做法已被弃用并将在 Python 3.20 中移除。(由 Sergey B Kirpichev 和 Serhiy Storchaka 在 gh-143715 中贡献。).)
在这些标准库模块中的
__version__,version和VERSION属性已被弃用并将在 Python 3.20 中移除。 请改用sys.version_info。ctypes.macholiblogging(__date__也已被弃用)xml.sax.expatreader
(由 Hugo van Kemenade 和 Stan Ulbrych 在 gh-76007 中贡献。)
The
__author__,__credits__,__copyright__and__date__attributes have been deprecated in these standard library modules and will be removed in Python 3.20. Attribution is preserved in the source code and the version control history.(Contributed by Stan Ulbrych in gh-159240.)
由 PEP 829 定义的弃用:
为在
name.pth文件中找到的import行产生警告。name.pth文件将不再以默认语言区域编码格式解码。 它们 必须 使用utf-8-sig编码。
(由 Barry Warsaw 在 gh-148641 中贡献。)
ast:创建抽象 AST 节点 (如
ast.AST或ast.expr) 的做法已被弃用并将在 Python 3.20 中引发错误。
-
在未显式地使用
runtime_checkable()来装饰但继承自运行时可检测协议类的协议类上调用isinstance()和issubclass()检测的做法已被弃用。 在 Python 3.20 中这会引发TypeError。(由 Bartosz Sławecki 在 gh-132604 中贡献。)