Python 3.14 中待移除的項目¶
argparse:argparse.BooleanOptionalAction的 type、choices 和 metavar 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev 於 gh-92248 貢獻。)ast:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時會於 runtime 發出DeprecationWarning,並將在 Python 3.14 中移除:ast.Numast.Strast.Bytesast.NameConstantast.Ellipsis
請改用
ast.Constant。(由 Serhiy Storchaka 於 gh-90953 貢獻。)-
已棄用並將在 Python 3.14 中移除的 child watcher 類別:
asyncio.MultiLoopChildWatcher、asyncio.FastChildWatcher、asyncio.AbstractChildWatcher和asyncio.SafeChildWatcher。 (由 Kumar Aditya 於 gh-94597 貢獻。)asyncio.set_child_watcher()、asyncio.get_child_watcher()、asyncio.AbstractEventLoopPolicy.set_child_watcher()和asyncio.AbstractEventLoopPolicy.get_child_watcher()已被棄用並將在 Python 3.14 中移除。(由 Kumar Aditya 於 gh-94597 貢獻。)預設事件迴圈策略的
get_event_loop()方法現在會在沒有設定目前事件迴圈且決定建立一個時發出DeprecationWarning。 (由 Serhiy Storchaka 和 Guido van Rossum 於 gh-100160 貢獻。)
email:已棄用email.utils.localtime()中的 isdst 參數。(由 Alan Williams 於 gh-72346 貢獻。)importlib.abc的已棄用類別:importlib.abc.ResourceReaderimportlib.abc.Traversableimportlib.abc.TraversableResources
請改用
importlib.resources.abc類別:(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 gh-93963。)
itertools有不以文件記錄、效率低下、過去常有 bug 且不一致的 copy、deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 (由 Raymond Hettinger 於 gh-101588 貢獻。)multiprocessing:預設的啟動方法將在 Linux、BSD 和其他非 macOS POSIX 平台上更改為更安全的 方法,目前'fork'是預設值 (gh-84559)。對此增加一個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使用get_context()或set_start_method()API 來明確指定你的程式碼何時需要'fork'。請參閱 Contexts and start methods。pathlib:已棄用is_relative_to()和relative_to():額外引數的傳遞已被棄用。pkgutil:pkgutil.find_loader()和pkgutil.get_loader()現在會引發DeprecationWarning;請改用importlib.util.find_spec()。 (由 Nikita Sobolev 於 gh-97850 貢獻。)pty:master_open():請用pty.openpty()。slave_open():請用pty.openpty()。
-
version和version_info。execute()和executemany(),如果使用 named placeholders 且 parameters 是序列而不是dict。
urllib:urllib.parse.Quoter已被棄用:它並非預期的公開 API。(由 Gregory P. Smith 於 gh-88168 貢獻。)