Документация Python неофициальный перевод

index.md

333 строк · 55.0 КБ · обычная страница · сырой текст · скачать

1> **Источник:** https://python-all.ru/3.14/deprecations/index.html2>3> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.45---67# Устаревания89## Ожидается удаление в Python 3.151011- Система импорта:1213  - Установка [`__cached__`](https://python-all.ru/3.14/reference/datamodel.html#module.__cached__) в модуле без установки [`__spec__.cached`](https://python-all.ru/3.14/library/importlib.html#importlib.machinery.ModuleSpec.cached) считается устаревшей. Начиная с Python 3.15 `__cached__` больше не будет устанавливаться или учитываться системой импорта или стандартной библиотекой. ([gh-97879](https://python-all.ru/3.14/deprecations/index.html))14  - Установка [`__package__`](https://python-all.ru/3.14/reference/datamodel.html#module.__package__) в модуле без установки [`__spec__.parent`](https://python-all.ru/3.14/library/importlib.html#importlib.machinery.ModuleSpec.parent) считается устаревшей. Начиная с Python 3.15 `__package__` больше не будет устанавливаться или учитываться системой импорта или стандартной библиотекой. ([gh-97879](https://python-all.ru/3.14/deprecations/index.html))15- [`ctypes`](https://python-all.ru/3.14/library/ctypes.html#module-ctypes):1617  - Незадокументированная функция `ctypes.SetPointerType()` считается устаревшей начиная с Python 3.13.18- [`http.server`](https://python-all.ru/3.14/library/http.server.html#module-http.server):1920  - Устаревшая и редко используемая [`CGIHTTPRequestHandler`](https://python-all.ru/3.14/library/http.server.html#http.server.CGIHTTPRequestHandler) считается устаревшей начиная с Python 3.13. Прямой замены не существует. *Что угодно* лучше, чем CGI, для взаимодействия веб-сервера с обработчиком запросов.21  - Флаг `--cgi` для **python -m http.server** интерфейса командной строки считается устаревшим начиная с Python 3.13.22- [`importlib`](https://python-all.ru/3.14/library/importlib.html#module-importlib):2324  - Метод `load_module()`: вместо него используйте `exec_module()`.25- [`pathlib`](https://python-all.ru/3.14/library/pathlib.html#module-pathlib):2627  - [`PurePath.is_reserved()`](https://python-all.ru/3.14/library/pathlib.html#pathlib.PurePath.is_reserved) считается устаревшим начиная с Python 3.13. Используйте [`os.path.isreserved()`](https://python-all.ru/3.14/library/os.path.html#os.path.isreserved) для обнаружения зарезервированных путей в Windows.28- [`platform`](https://python-all.ru/3.14/library/platform.html#module-platform):2930  - [`java_ver()`](https://python-all.ru/3.14/library/platform.html#platform.java_ver) считается устаревшим начиная с Python 3.13. Эта функция полезна только для поддержки Jython, имеет запутанный API и в значительной степени не тестировалась.31- [`sysconfig`](https://python-all.ru/3.14/library/sysconfig.html#module-sysconfig):3233  - Аргумент *check\_home* функции [`sysconfig.is_python_build()`](https://python-all.ru/3.14/library/sysconfig.html#sysconfig.is_python_build) считается устаревшим начиная с Python 3.12.34- [`threading`](https://python-all.ru/3.14/library/threading.html#module-threading):3536  - [`RLock()`](https://python-all.ru/3.14/library/threading.html#threading.RLock) не будет принимать аргументов в Python 3.15. Передача любых аргументов считается устаревшей начиная с Python 3.14, поскольку версия на Python не допускает никаких аргументов, но версия на C позволяет любое количество позиционных или именованных аргументов, игнорируя все аргументы.37- [`types`](https://python-all.ru/3.14/library/types.html#module-types):3839  - [`types.CodeType`](https://python-all.ru/3.14/library/types.html#types.CodeType): доступ к [`co_lnotab`](https://python-all.ru/3.14/reference/datamodel.html#codeobject.co_lnotab) был объявлен устаревшим в [**PEP 626**](https://python-all.ru/3.14/deprecations/index.html) начиная с версии 3.10 и планировался к удалению в 3.12, но получил надлежащий [`DeprecationWarning`](https://python-all.ru/3.14/library/exceptions.html#DeprecationWarning) только в 3.12. Может быть удалён в 3.15. (Предложено Никитой Соболевым в [gh-101866](https://python-all.ru/3.14/deprecations/index.html).)40- [`typing`](https://python-all.ru/3.14/library/typing.html#module-typing):4142  - Незадокументированный синтаксис именованных аргументов для создания классов [`NamedTuple`](https://python-all.ru/3.14/library/typing.html#typing.NamedTuple) (например, `Point = NamedTuple("Point", x=int, y=int)`) считается устаревшим начиная с Python 3.13. Вместо этого используйте синтаксис на основе классов или функциональный синтаксис.43  - При использовании функционального синтаксиса [`TypedDict`](https://python-all.ru/3.14/library/typing.html#typing.TypedDict), отсутствие передачи значения параметру *поля* (`TD = TypedDict("TD")`) или передача `None` (`TD = TypedDict("TD", None)`) считается устаревшим начиная с Python 3.13. Используйте `class TD(TypedDict): pass` или `TD = TypedDict("TD", {})` для создания TypedDict без полей.44  - Функция-декоратор [`typing.no_type_check_decorator()`](https://python-all.ru/3.14/library/typing.html#typing.no_type_check_decorator) считается устаревшей начиная с Python 3.13. За восемь лет в модуле [`typing`](https://python-all.ru/3.14/library/typing.html#module-typing) она так и не была поддержана ни одним крупным средством проверки типов.45- [`wave`](https://python-all.ru/3.14/library/wave.html#module-wave):4647  - Методы [`getmark()`](https://python-all.ru/3.14/library/wave.html#wave.Wave_read.getmark), `setmark()` и [`getmarkers()`](https://python-all.ru/3.14/library/wave.html#wave.Wave_read.getmarkers) классов [`Wave_read`](https://python-all.ru/3.14/library/wave.html#wave.Wave_read) и [`Wave_write`](https://python-all.ru/3.14/library/wave.html#wave.Wave_write) устарели начиная с Python 3.13.48- [`zipimport`](https://python-all.ru/3.14/library/zipimport.html#module-zipimport):4950  - [`load_module()`](https://python-all.ru/3.14/library/zipimport.html#zipimport.zipimporter.load_module) устарел начиная с Python 3.10. Вместо него используйте [`exec_module()`](https://python-all.ru/3.14/library/zipimport.html#zipimport.zipimporter.exec_module). (Внёс вклад Jiahao Li в [gh-125746](https://python-all.ru/3.14/deprecations/index.html).)5152## Запланировано к удалению в Python 3.165354- Система импорта:5556  - Установка [`__loader__`](https://python-all.ru/3.14/reference/datamodel.html#module.__loader__) в модуле при отсутствии [`__spec__.loader`](https://python-all.ru/3.14/library/importlib.html#importlib.machinery.ModuleSpec.loader) устарела. В Python 3.16 `__loader__` перестанет устанавливаться или учитываться системой импорта или стандартной библиотекой.57- [`array`](https://python-all.ru/3.14/library/array.html#module-array):5859  - Код формата `'u'` (`wchar_t`) устарел в документации начиная с Python 3.3 и во время выполнения начиная с Python 3.13. Используйте код формата `'w'` ([`Py_UCS4`](https://python-all.ru/3.14/c-api/unicode.html#c.Py_UCS4)) для символов Unicode.60- [`asyncio`](https://python-all.ru/3.14/library/asyncio.html#module-asyncio):6162  - `asyncio.iscoroutinefunction()` устарело и будет удалено в Python 3.16; используйте [`inspect.iscoroutinefunction()`](https://python-all.ru/3.14/library/inspect.html#inspect.iscoroutinefunction) вместо этого. (Предложено Jiahao Li и Kumar Aditya в [gh-122875](https://python-all.ru/3.14/deprecations/index.html).)63  - Система политик [`asyncio`](https://python-all.ru/3.14/library/asyncio.html#module-asyncio) устарела и будет удалена в Python 3.16. В частности, следующие классы и функции устарели:6465    - [`asyncio.AbstractEventLoopPolicy`](https://python-all.ru/3.14/library/asyncio-policy.html#asyncio.AbstractEventLoopPolicy)66    - [`asyncio.DefaultEventLoopPolicy`](https://python-all.ru/3.14/library/asyncio-policy.html#asyncio.DefaultEventLoopPolicy)67    - [`asyncio.WindowsSelectorEventLoopPolicy`](https://python-all.ru/3.14/library/asyncio-policy.html#asyncio.WindowsSelectorEventLoopPolicy)68    - [`asyncio.WindowsProactorEventLoopPolicy`](https://python-all.ru/3.14/library/asyncio-policy.html#asyncio.WindowsProactorEventLoopPolicy)69    - [`asyncio.get_event_loop_policy()`](https://python-all.ru/3.14/library/asyncio-policy.html#asyncio.get_event_loop_policy)70    - [`asyncio.set_event_loop_policy()`](https://python-all.ru/3.14/library/asyncio-policy.html#asyncio.set_event_loop_policy)7172    Для использования нужной реализации цикла событий следует применять [`asyncio.run()`](https://python-all.ru/3.14/library/asyncio-runner.html#asyncio.run) или [`asyncio.Runner`](https://python-all.ru/3.14/library/asyncio-runner.html#asyncio.Runner) с параметром *loop\_factory*.7374    Например, чтобы использовать [`asyncio.SelectorEventLoop`](https://python-all.ru/3.14/library/asyncio-eventloop.html#asyncio.SelectorEventLoop) в Windows:7576    ```python77    import asyncio7879    async def main():80        ...8182    asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)83    ```8485    (Предложено Kumar Aditya в [gh-127949](https://python-all.ru/3.14/deprecations/index.html).)86- [`builtins`](https://python-all.ru/3.14/library/builtins.html#module-builtins):8788  - Поразрядная инверсия для булевых типов, `~True` или `~False` устарела начиная с Python 3.12, поскольку даёт неожиданные и неинтуитивные результаты (`-2` и `-1`). Используйте `not x` для логического отрицания булевого значения. В редких случаях, когда требуется поразрядная инверсия базового целого числа, явно преобразуйте в `int` (`~int(x)`).89- [`functools`](https://python-all.ru/3.14/library/functools.html#module-functools):9091  - Вызов реализации [`functools.reduce()`](https://python-all.ru/3.14/library/functools.html#functools.reduce) на Python с *function* или *sequence* в качестве именованных аргументов устарел начиная с Python 3.14.92- [`logging`](https://python-all.ru/3.14/library/logging.html#module-logging):9394  Поддержка пользовательских обработчиков логирования с аргументом *strm* устарела и запланирована к удалению в Python 3.16. Вместо этого определяйте обработчики с аргументом *stream*. (Предложено Mariusz Felisiak в [gh-115032](https://python-all.ru/3.14/deprecations/index.html).)95- [`mimetypes`](https://python-all.ru/3.14/library/mimetypes.html#module-mimetypes):9697  - Допустимые расширения начинаются с точки ‘.’ или пусты для [`mimetypes.MimeTypes.add_type()`](https://python-all.ru/3.14/library/mimetypes.html#mimetypes.MimeTypes.add_type). Расширения без точки устарели и будут вызывать [`ValueError`](https://python-all.ru/3.14/library/exceptions.html#ValueError) в Python 3.16. (Предложено Hugo van Kemenade в [gh-75223](https://python-all.ru/3.14/deprecations/index.html).)98- [`shutil`](https://python-all.ru/3.14/library/shutil.html#module-shutil):99100  - Исключение `ExecError` устарело начиная с Python 3.14. Оно не используется ни одной функцией в `shutil` начиная с Python 3.4 и теперь является псевдонимом [`RuntimeError`](https://python-all.ru/3.14/library/exceptions.html#RuntimeError).101- [`symtable`](https://python-all.ru/3.14/library/symtable.html#module-symtable):102103  - Метод [`Class.get_methods`](https://python-all.ru/3.14/library/symtable.html#symtable.Class.get_methods) устарел начиная с Python 3.14.104- [`sys`](https://python-all.ru/3.14/library/sys.html#module-sys):105106  - Функция [`_enablelegacywindowsfsencoding()`](https://python-all.ru/3.14/library/sys.html#sys._enablelegacywindowsfsencoding) устарела начиная с Python 3.13. Используйте переменную окружения [`PYTHONLEGACYWINDOWSFSENCODING`](https://python-all.ru/3.14/using/cmdline.html#envvar-PYTHONLEGACYWINDOWSFSENCODING).107- [`sysconfig`](https://python-all.ru/3.14/library/sysconfig.html#module-sysconfig):108109  - Функция `sysconfig.expand_makefile_vars()` устарела начиная с Python 3.14. Используйте аргумент `vars` из [`sysconfig.get_paths()`](https://python-all.ru/3.14/library/sysconfig.html#sysconfig.get_paths).110- [`tarfile`](https://python-all.ru/3.14/library/tarfile.html#module-tarfile):111112  - Недокументированный и неиспользуемый атрибут `TarFile.tarfile` устарел начиная с Python 3.13.113114## Запланировано к удалению в Python 3.17115116- [`collections.abc`](https://python-all.ru/3.14/library/collections.abc.html#module-collections.abc):117118  - [`collections.abc.ByteString`](https://python-all.ru/3.14/library/collections.abc.html#collections.abc.ByteString) запланирован к удалению в Python 3.17.119120    Используйте `isinstance(obj, collections.abc.Buffer)` для проверки, реализует ли `obj` [протокол буфера](https://python-all.ru/3.14/c-api/buffer.html#bufferobjects) во время выполнения. Для использования в аннотациях типов используйте [`Buffer`](https://python-all.ru/3.14/library/collections.abc.html#collections.abc.Buffer) или объединение, которое явно указывает типы, поддерживаемые вашим кодом (например, `bytes | bytearray | memoryview`).121122    `ByteString` изначально задумывался как абстрактный класс, который должен был служить супертипом как для [`bytes`](https://python-all.ru/3.14/library/stdtypes.html#bytes), так и для [`bytearray`](https://python-all.ru/3.14/library/stdtypes.html#bytearray). Однако, поскольку у ABC никогда не было методов, знание того, что объект является экземпляром `ByteString`, никогда не давало полезной информации об объекте. Другие распространённые типы буферов, такие как [`memoryview`](https://python-all.ru/3.14/library/stdtypes.html#memoryview), также никогда не рассматривались как подтипы `ByteString` (ни во время выполнения, ни статическими проверками типов).123124    См. [**PEP 688**](https://python-all.ru/3.14/deprecations/index.html) для получения подробностей. (Автор: Shantanu Jain в [gh-91896](https://python-all.ru/3.14/deprecations/index.html).)125- [`typing`](https://python-all.ru/3.14/library/typing.html#module-typing):126127  - До Python 3.14 старые объединения реализовывались с помощью приватного класса `typing._UnionGenericAlias`. Этот класс больше не нужен для реализации, но он сохранён для обратной совместимости, его удаление запланировано на Python 3.17. Пользователям следует использовать документированные вспомогательные средства интроспекции, такие как [`typing.get_origin()`](https://python-all.ru/3.14/library/typing.html#typing.get_origin) и [`typing.get_args()`](https://python-all.ru/3.14/library/typing.html#typing.get_args), вместо того чтобы полагаться на детали приватной реализации.128  - [`typing.ByteString`](https://python-all.ru/3.14/library/typing.html#typing.ByteString), устаревший с Python 3.9, запланирован к удалению в Python 3.17.129130    Используйте `isinstance(obj, collections.abc.Buffer)` для проверки, реализует ли `obj` [протокол буфера](https://python-all.ru/3.14/c-api/buffer.html#bufferobjects) во время выполнения. Для использования в аннотациях типов используйте [`Buffer`](https://python-all.ru/3.14/library/collections.abc.html#collections.abc.Buffer) или объединение, которое явно указывает типы, поддерживаемые вашим кодом (например, `bytes | bytearray | memoryview`).131132    `ByteString` изначально задумывался как абстрактный класс, который должен был служить супертипом как для [`bytes`](https://python-all.ru/3.14/library/stdtypes.html#bytes), так и для [`bytearray`](https://python-all.ru/3.14/library/stdtypes.html#bytearray). Однако, поскольку у ABC никогда не было методов, знание того, что объект является экземпляром `ByteString`, никогда не давало полезной информации об объекте. Другие распространённые типы буферов, такие как [`memoryview`](https://python-all.ru/3.14/library/stdtypes.html#memoryview), также никогда не рассматривались как подтипы `ByteString` (ни во время выполнения, ни статическими проверками типов).133134    См. [**PEP 688**](https://python-all.ru/3.14/deprecations/index.html) для получения подробностей. (Автор: Shantanu Jain в [gh-91896](https://python-all.ru/3.14/deprecations/index.html).)135136## Запланировано удаление в Python 3.18137138- [`decimal`](https://python-all.ru/3.14/library/decimal.html#module-decimal):139140  - Нестандартный и недокументированный [`Decimal`](https://python-all.ru/3.14/library/decimal.html#decimal.Decimal) спецификатор формата `'N'`, который поддерживается только в реализации C модуля `decimal`, устарел с Python 3.13. (Автор: Serhiy Storchaka в [gh-89902](https://python-all.ru/3.14/deprecations/index.html).)141142## Запланировано к удалению в Python 3.19143144- [`ctypes`](https://python-all.ru/3.14/library/ctypes.html#module-ctypes):145146  - Неявное переключение на совместимую с MSVC структуру путём установки [`_pack_`](https://python-all.ru/3.14/library/ctypes.html#ctypes.Structure._pack_) без [`_layout_`](https://python-all.ru/3.14/library/ctypes.html#ctypes.Structure._layout_) на платформах, отличных от Windows.147148## Будет удалено в будущих версиях149150Следующие API будут удалены в будущем, хотя на данный момент нет запланированной даты их удаления.151152- [`argparse`](https://python-all.ru/3.14/library/argparse.html#module-argparse):153154  - Вложение групп аргументов и вложение взаимоисключающих групп устарело.155  - Передача недокументированного именованного аргумента *prefix\_chars* в [`add_argument_group()`](https://python-all.ru/3.14/library/argparse.html#argparse.ArgumentParser.add_argument_group) теперь устарела.156  - Конвертер типов [`argparse.FileType`](https://python-all.ru/3.14/library/argparse.html#argparse.FileType) устарел.157- [`builtins`](https://python-all.ru/3.14/library/builtins.html#module-builtins):158159  - Генераторы: сигнатура `throw(type, exc, tb)` и `athrow(type, exc, tb)` устарела: используйте `throw(exc)` и `athrow(exc)` вместо неё, сигнатуру с одним аргументом.160  - В настоящее время Python принимает числовые литералы, за которыми сразу следуют ключевые слова, например `0in x`, `1or x`, `0if 1else 2`. Это допускает запутанные и неоднозначные выражения вроде `[0x1for x in y]` (которое может быть интерпретировано как `[0x1 for x in y]` или `[0x1f or x in y]`). Выдаётся предупреждение синтаксиса, если за числовым литералом сразу следует одно из ключевых слов [`and`](https://python-all.ru/3.14/reference/expressions.html#and), [`else`](https://python-all.ru/3.14/reference/compound_stmts.html#else), [`for`](https://python-all.ru/3.14/reference/compound_stmts.html#for), [`if`](https://python-all.ru/3.14/reference/compound_stmts.html#if), [`in`](https://python-all.ru/3.14/reference/expressions.html#in), [`is`](https://python-all.ru/3.14/reference/expressions.html#is) и [`or`](https://python-all.ru/3.14/reference/expressions.html#or). В будущем выпуске это будет изменено на синтаксическую ошибку. ([gh-87999](https://python-all.ru/3.14/deprecations/index.html))161  - Поддержка методов `__index__()` и `__int__()`, возвращающих не-int тип: эти методы должны будут возвращать экземпляр строгого подкласса [`int`](https://python-all.ru/3.14/library/functions.html#int).162  - Поддержка метода `__float__()`, возвращающего строгий подкласс [`float`](https://python-all.ru/3.14/library/functions.html#float): эти методы должны будут возвращать экземпляр `float`.163  - Поддержка метода `__complex__()`, возвращающего строгий подкласс [`complex`](https://python-all.ru/3.14/library/functions.html#complex): эти методы должны будут возвращать экземпляр `complex`.164  - Передача комплексного числа в качестве аргумента *real* или *imag* в конструкторе [`complex()`](https://python-all.ru/3.14/library/functions.html#complex) теперь устарела; его следует передавать только как единственный позиционный аргумент. (Автор: Сергей Сторчака в [gh-109218](https://python-all.ru/3.14/deprecations/index.html).)165- [`calendar`](https://python-all.ru/3.14/library/calendar.html#module-calendar): константы `calendar.January` и `calendar.February` устарели и заменены на [`calendar.JANUARY`](https://python-all.ru/3.14/library/calendar.html#calendar.JANUARY) и [`calendar.FEBRUARY`](https://python-all.ru/3.14/library/calendar.html#calendar.FEBRUARY). (Автор: Prince Roshan в [gh-103636](https://python-all.ru/3.14/deprecations/index.html).)166- [`codecs`](https://python-all.ru/3.14/library/codecs.html#module-codecs): используйте [`open()`](https://python-all.ru/3.14/library/functions.html#open) вместо [`codecs.open()`](https://python-all.ru/3.14/library/codecs.html#codecs.open). ([gh-133038](https://python-all.ru/3.14/deprecations/index.html))167- [`codeobject.co_lnotab`](https://python-all.ru/3.14/reference/datamodel.html#codeobject.co_lnotab): используйте метод [`codeobject.co_lines()`](https://python-all.ru/3.14/reference/datamodel.html#codeobject.co_lines) вместо этого.168- [`datetime`](https://python-all.ru/3.14/library/datetime.html#module-datetime):169170  - [`utcnow()`](https://python-all.ru/3.14/library/datetime.html#datetime.datetime.utcnow): используйте `datetime.datetime.now(tz=datetime.UTC)`.171  - [`utcfromtimestamp()`](https://python-all.ru/3.14/library/datetime.html#datetime.datetime.utcfromtimestamp): используйте `datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)`.172- [`gettext`](https://python-all.ru/3.14/library/gettext.html#module-gettext): значение множественного числа должно быть целым числом.173- [`importlib`](https://python-all.ru/3.14/library/importlib.html#module-importlib):174175  - [`cache_from_source()`](https://python-all.ru/3.14/library/importlib.html#importlib.util.cache_from_source): параметр *debug\_override* устарел: используйте параметр *optimization* вместо него.176- [`importlib.metadata`](https://python-all.ru/3.14/library/importlib.metadata.html#module-importlib.metadata):177178  - `EntryPoints`: интерфейс кортежа.179  - Неявное `None` для возвращаемых значений.180- [`logging`](https://python-all.ru/3.14/library/logging.html#module-logging): метод `warn()` устарел начиная с Python 3.3, используйте [`warning()`](https://python-all.ru/3.14/library/logging.html#logging.warning) вместо него.181- [`mailbox`](https://python-all.ru/3.14/library/mailbox.html#module-mailbox): использование StringIO в режиме ввода и текстовом режиме устарело, используйте BytesIO и двоичный режим.182- [`os`](https://python-all.ru/3.14/library/os.html#module-os): вызов [`os.register_at_fork()`](https://python-all.ru/3.14/library/os.html#os.register_at_fork) в многопоточном процессе.183- `pydoc.ErrorDuringImport`: кортежное значение для параметра *exc\_info* устарело, используйте экземпляр исключения.184- [`re`](https://python-all.ru/3.14/library/re.html#module-re): теперь применяются более строгие правила для числовых ссылок на группы и имён групп в регулярных выражениях. В качестве числовой ссылки теперь принимается только последовательность цифр ASCII. Имя группы в байтовых шаблонах и строках замены теперь может содержать только буквы ASCII, цифры и знак подчёркивания. (Автор: Сергей Сторчака в [gh-91760](https://python-all.ru/3.14/deprecations/index.html).)185- Модули `sre_compile`, `sre_constants` и `sre_parse`.186- [`shutil`](https://python-all.ru/3.14/library/shutil.html#module-shutil): параметр *onerror* метода [`rmtree()`](https://python-all.ru/3.14/library/shutil.html#shutil.rmtree) устарел в Python 3.12; используйте параметр *onexc* вместо него.187- [`ssl`](https://python-all.ru/3.14/library/ssl.html#module-ssl): опции и протоколы:188189  - [`ssl.SSLContext`](https://python-all.ru/3.14/library/ssl.html#ssl.SSLContext) без аргумента протокол устарело.190  - [`ssl.SSLContext`](https://python-all.ru/3.14/library/ssl.html#ssl.SSLContext): [`set_npn_protocols()`](https://python-all.ru/3.14/library/ssl.html#ssl.SSLContext.set_npn_protocols) и `selected_npn_protocol()` устарели: используйте ALPN вместо них.191  - `ssl.OP_NO_SSL*`: опции192  - `ssl.OP_NO_TLS*`: опции193  - `ssl.PROTOCOL_SSLv3`194  - `ssl.PROTOCOL_TLS`195  - `ssl.PROTOCOL_TLSv1`196  - `ssl.PROTOCOL_TLSv1_1`197  - `ssl.PROTOCOL_TLSv1_2`198  - `ssl.TLSVersion.SSLv3`199  - `ssl.TLSVersion.TLSv1`200  - `ssl.TLSVersion.TLSv1_1`201- [`threading`](https://python-all.ru/3.14/library/threading.html#module-threading): методы202203  - `threading.Condition.notifyAll()`: используйте [`notify_all()`](https://python-all.ru/3.14/library/threading.html#threading.Condition.notify_all).204  - `threading.Event.isSet()`: используйте [`is_set()`](https://python-all.ru/3.14/library/threading.html#threading.Event.is_set).205  - `threading.Thread.isDaemon()`, [`threading.Thread.setDaemon()`](https://python-all.ru/3.14/library/threading.html#threading.Thread.setDaemon): используйте атрибут [`threading.Thread.daemon`](https://python-all.ru/3.14/library/threading.html#threading.Thread.daemon).206  - `threading.Thread.getName()`, [`threading.Thread.setName()`](https://python-all.ru/3.14/library/threading.html#threading.Thread.setName): используйте атрибут [`threading.Thread.name`](https://python-all.ru/3.14/library/threading.html#threading.Thread.name).207  - `threading.currentThread()`: используйте [`threading.current_thread()`](https://python-all.ru/3.14/library/threading.html#threading.current_thread).208  - `threading.activeCount()`: используйте [`threading.active_count()`](https://python-all.ru/3.14/library/threading.html#threading.active_count).209- [`typing.Text`](https://python-all.ru/3.14/library/typing.html#typing.Text) ([gh-92332](https://python-all.ru/3.14/deprecations/index.html)).210- Внутренний класс `typing._UnionGenericAlias` больше не используется для реализации [`typing.Union`](https://python-all.ru/3.14/library/typing.html#typing.Union). Для сохранения совместимости с пользователями, использующими этот закрытый класс, будет предоставлена прослойка совместимости как минимум до Python 3.17. (Автор: Jelle Zijlstra, [gh-105499](https://python-all.ru/3.14/deprecations/index.html).)211- [`unittest.IsolatedAsyncioTestCase`](https://python-all.ru/3.14/library/unittest.html#unittest.IsolatedAsyncioTestCase): возврат значения, не являющегося `None`, из тестового примера устарел.212- [`urllib.parse`](https://python-all.ru/3.14/library/urllib.parse.html#module-urllib.parse) устаревшие функции: используйте [`urlparse()`](https://python-all.ru/3.14/library/urllib.parse.html#urllib.parse.urlparse) вместо них.213214  - `splitattr()`215  - `splithost()`216  - `splitnport()`217  - `splitpasswd()`218  - `splitport()`219  - `splitquery()`220  - `splittag()`221  - `splittype()`222  - `splituser()`223  - `splitvalue()`224  - `to_bytes()`225- [`wsgiref`](https://python-all.ru/3.14/library/wsgiref.html#module-wsgiref): `SimpleHandler.stdout.write()` не должна выполнять частичную запись.226- [`xml.etree.ElementTree`](https://python-all.ru/3.14/library/xml.etree.elementtree.html#module-xml.etree.ElementTree): проверка истинностного значения [`Element`](https://python-all.ru/3.14/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element) устарела. В будущем выпуске она всегда будет возвращать `True`. Вместо этого используйте явные проверки `len(elem)` или `elem is not None`.227- [`sys._clear_type_cache()`](https://python-all.ru/3.14/library/sys.html#sys._clear_type_cache) устарело: используйте [`sys._clear_internal_caches()`](https://python-all.ru/3.14/library/sys.html#sys._clear_internal_caches) вместо него.228229## Устаревания в C API230231### Ожидается удаление в Python 3.15232233- [`PyImport_ImportModuleNoBlock()`](https://python-all.ru/3.14/c-api/import.html#c.PyImport_ImportModuleNoBlock): Вместо этого используйте [`PyImport_ImportModule()`](https://python-all.ru/3.14/c-api/import.html#c.PyImport_ImportModule).234- [`PyWeakref_GetObject()`](https://python-all.ru/3.14/c-api/weakref.html#c.PyWeakref_GetObject) и [`PyWeakref_GET_OBJECT()`](https://python-all.ru/3.14/c-api/weakref.html#c.PyWeakref_GET_OBJECT): Вместо этого используйте [`PyWeakref_GetRef()`](https://python-all.ru/3.14/c-api/weakref.html#c.PyWeakref_GetRef). Проект [pythoncapi-compat](https://python-all.ru/3.14/deprecations/index.html) можно использовать, чтобы получить `PyWeakref_GetRef()` на Python 3.12 и старше.235- Тип [`Py_UNICODE`](https://python-all.ru/3.14/c-api/unicode.html#c.Py_UNICODE) и макрос `Py_UNICODE_WIDE`: Вместо них используйте `wchar_t`.236- `PyUnicode_AsDecodedObject()`: Вместо этого используйте [`PyCodec_Decode()`](https://python-all.ru/3.14/c-api/codec.html#c.PyCodec_Decode).237- `PyUnicode_AsDecodedUnicode()`: Вместо этого используйте [`PyCodec_Decode()`](https://python-all.ru/3.14/c-api/codec.html#c.PyCodec_Decode); Обратите внимание, что некоторые кодеки (например, «base64») могут возвращать тип, отличный от [`str`](https://python-all.ru/3.14/library/stdtypes.html#str), например, [`bytes`](https://python-all.ru/3.14/library/stdtypes.html#bytes).238- `PyUnicode_AsEncodedObject()`: Вместо этого используйте [`PyCodec_Encode()`](https://python-all.ru/3.14/c-api/codec.html#c.PyCodec_Encode).239- `PyUnicode_AsEncodedUnicode()`: Вместо этого используйте [`PyCodec_Encode()`](https://python-all.ru/3.14/c-api/codec.html#c.PyCodec_Encode); Обратите внимание, что некоторые кодеки (например, «base64») могут возвращать тип, отличный от [`bytes`](https://python-all.ru/3.14/library/stdtypes.html#bytes), например, [`str`](https://python-all.ru/3.14/library/stdtypes.html#str).240- Функции инициализации Python, устаревшие в Python 3.13:241242  - [`Py_GetPath()`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_GetPath): Вместо этого используйте [`PyConfig_Get("module_search_paths")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) ([`sys.path`](https://python-all.ru/3.14/library/sys.html#sys.path)).243  - [`Py_GetPrefix()`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_GetPrefix): Вместо этого используйте [`PyConfig_Get("base_prefix")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) ([`sys.base_prefix`](https://python-all.ru/3.14/library/sys.html#sys.base_prefix)). Используйте `PyConfig_Get("prefix")` ([`sys.prefix`](https://python-all.ru/3.14/library/sys.html#sys.prefix)), если необходимо обрабатывать [виртуальные окружения](https://python-all.ru/3.14/library/venv.html#venv-def).244  - [`Py_GetExecPrefix()`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_GetExecPrefix): Вместо этого используйте [`PyConfig_Get("base_exec_prefix")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) ([`sys.base_exec_prefix`](https://python-all.ru/3.14/library/sys.html#sys.base_exec_prefix)). Используйте `PyConfig_Get("exec_prefix")` ([`sys.exec_prefix`](https://python-all.ru/3.14/library/sys.html#sys.exec_prefix)), если необходимо обрабатывать [виртуальные окружения](https://python-all.ru/3.14/library/venv.html#venv-def).245  - [`Py_GetProgramFullPath()`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_GetProgramFullPath): Вместо этого используйте [`PyConfig_Get("executable")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) ([`sys.executable`](https://python-all.ru/3.14/library/sys.html#sys.executable)).246  - [`Py_GetProgramName()`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_GetProgramName): Вместо этого используйте [`PyConfig_Get("executable")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) ([`sys.executable`](https://python-all.ru/3.14/library/sys.html#sys.executable)).247  - [`Py_GetPythonHome()`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_GetPythonHome): Используйте [`PyConfig_Get("home")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) или переменную окружения [`PYTHONHOME`](https://python-all.ru/3.14/using/cmdline.html#envvar-PYTHONHOME).248249  Проект [pythoncapi-compat](https://python-all.ru/3.14/deprecations/index.html) можно использовать, чтобы получить [`PyConfig_Get()`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) на Python 3.13 и старше.250- Функции для настройки инициализации Python, устаревшие в Python 3.11:251252  - `PySys_SetArgvEx()`: Вместо этого задайте [`PyConfig.argv`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.argv).253  - `PySys_SetArgv()`: Вместо этого задайте [`PyConfig.argv`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.argv).254  - `Py_SetProgramName()`: Вместо этого задайте [`PyConfig.program_name`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.program_name).255  - `Py_SetPythonHome()`: Вместо этого задайте [`PyConfig.home`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.home).256  - [`PySys_ResetWarnOptions()`](https://python-all.ru/3.14/c-api/sys.html#c.PySys_ResetWarnOptions): Вместо этого очистите [`sys.warnoptions`](https://python-all.ru/3.14/library/sys.html#sys.warnoptions) и `warnings.filters`.257258  API [`Py_InitializeFromConfig()`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_InitializeFromConfig) следует использовать с [`PyConfig`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig) вместо этого.259- Глобальные переменные конфигурации:260261  - [`Py_DebugFlag`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_DebugFlag): Используйте [`PyConfig.parser_debug`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.parser_debug) или [`PyConfig_Get("parser_debug")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.262  - [`Py_VerboseFlag`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_VerboseFlag): Используйте [`PyConfig.verbose`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.verbose) или [`PyConfig_Get("verbose")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.263  - [`Py_QuietFlag`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_QuietFlag): Используйте [`PyConfig.quiet`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.quiet) или [`PyConfig_Get("quiet")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.264  - [`Py_InteractiveFlag`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_InteractiveFlag): Используйте [`PyConfig.interactive`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.interactive) или [`PyConfig_Get("interactive")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.265  - [`Py_InspectFlag`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_InspectFlag): Используйте [`PyConfig.inspect`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.inspect) или [`PyConfig_Get("inspect")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.266  - [`Py_OptimizeFlag`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_OptimizeFlag): Используйте [`PyConfig.optimization_level`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.optimization_level) или [`PyConfig_Get("optimization_level")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.267  - [`Py_NoSiteFlag`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_NoSiteFlag): Используйте [`PyConfig.site_import`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.site_import) или [`PyConfig_Get("site_import")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.268  - [`Py_BytesWarningFlag`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_BytesWarningFlag): Используйте [`PyConfig.bytes_warning`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.bytes_warning) или [`PyConfig_Get("bytes_warning")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.269  - [`Py_FrozenFlag`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_FrozenFlag): Используйте [`PyConfig.pathconfig_warnings`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.pathconfig_warnings) или [`PyConfig_Get("pathconfig_warnings")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.270  - [`Py_IgnoreEnvironmentFlag`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_IgnoreEnvironmentFlag): Используйте [`PyConfig.use_environment`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.use_environment) или [`PyConfig_Get("use_environment")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.271  - [`Py_DontWriteBytecodeFlag`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_DontWriteBytecodeFlag): Используйте [`PyConfig.write_bytecode`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.write_bytecode) или [`PyConfig_Get("write_bytecode")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.272  - [`Py_NoUserSiteDirectory`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_NoUserSiteDirectory): Используйте [`PyConfig.user_site_directory`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.user_site_directory) или [`PyConfig_Get("user_site_directory")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.273  - [`Py_UnbufferedStdioFlag`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_UnbufferedStdioFlag): Используйте [`PyConfig.buffered_stdio`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.buffered_stdio) или [`PyConfig_Get("buffered_stdio")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.274  - [`Py_HashRandomizationFlag`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_HashRandomizationFlag): Используйте [`PyConfig.use_hash_seed`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.use_hash_seed) и [`PyConfig.hash_seed`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.hash_seed) или [`PyConfig_Get("hash_seed")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.275  - [`Py_IsolatedFlag`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_IsolatedFlag): Используйте [`PyConfig.isolated`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.isolated) или [`PyConfig_Get("isolated")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.276  - [`Py_LegacyWindowsFSEncodingFlag`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_LegacyWindowsFSEncodingFlag): Используйте [`PyPreConfig.legacy_windows_fs_encoding`](https://python-all.ru/3.14/c-api/init_config.html#c.PyPreConfig.legacy_windows_fs_encoding) или [`PyConfig_Get("legacy_windows_fs_encoding")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.277  - [`Py_LegacyWindowsStdioFlag`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_LegacyWindowsStdioFlag): Используйте [`PyConfig.legacy_windows_stdio`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.legacy_windows_stdio) или [`PyConfig_Get("legacy_windows_stdio")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.278  - `Py_FileSystemDefaultEncoding`, `Py_HasFileSystemDefaultEncoding`: Используйте [`PyConfig.filesystem_encoding`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.filesystem_encoding) или [`PyConfig_Get("filesystem_encoding")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.279  - `Py_FileSystemDefaultEncodeErrors`: Используйте [`PyConfig.filesystem_errors`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig.filesystem_errors) или [`PyConfig_Get("filesystem_errors")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого.280  - `Py_UTF8Mode`: Используйте [`PyPreConfig.utf8_mode`](https://python-all.ru/3.14/c-api/init_config.html#c.PyPreConfig.utf8_mode) или [`PyConfig_Get("utf8_mode")`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) вместо этого. (см. [`Py_PreInitialize()`](https://python-all.ru/3.14/c-api/init_config.html#c.Py_PreInitialize))281282  API [`Py_InitializeFromConfig()`](https://python-all.ru/3.14/c-api/interp-lifecycle.html#c.Py_InitializeFromConfig) следует использовать с [`PyConfig`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig) для установки этих параметров. Или [`PyConfig_Get()`](https://python-all.ru/3.14/c-api/init_config.html#c.PyConfig_Get) можно использовать для получения этих параметров во время выполнения.283284### Запланировано удаление в Python 3.18285286- Следующие закрытые функции устарели и планируются к удалению в Python 3.18:287288  - `_PyBytes_Join()`: используйте [`PyBytes_Join()`](https://python-all.ru/3.14/c-api/bytes.html#c.PyBytes_Join).289  - `_PyDict_GetItemStringWithError()`: используйте [`PyDict_GetItemStringRef()`](https://python-all.ru/3.14/c-api/dict.html#c.PyDict_GetItemStringRef).290  - `_PyDict_Pop()`: используйте [`PyDict_Pop()`](https://python-all.ru/3.14/c-api/dict.html#c.PyDict_Pop).291  - `_PyLong_Sign()`: используйте [`PyLong_GetSign()`](https://python-all.ru/3.14/c-api/long.html#c.PyLong_GetSign).292  - `_PyLong_FromDigits()` и `_PyLong_New()`: используйте [`PyLongWriter_Create()`](https://python-all.ru/3.14/c-api/long.html#c.PyLongWriter_Create).293  - `_PyThreadState_UncheckedGet()`: используйте [`PyThreadState_GetUnchecked()`](https://python-all.ru/3.14/c-api/threads.html#c.PyThreadState_GetUnchecked).294  - `_PyUnicode_AsString()`: используйте [`PyUnicode_AsUTF8()`](https://python-all.ru/3.14/c-api/unicode.html#c.PyUnicode_AsUTF8).295  - `_PyUnicodeWriter_Init()`: заменить `_PyUnicodeWriter_Init(&writer)` на [`writer = PyUnicodeWriter_Create(0)`](https://python-all.ru/3.14/c-api/unicode.html#c.PyUnicodeWriter_Create).296  - `_PyUnicodeWriter_Finish()`: заменить `_PyUnicodeWriter_Finish(&writer)` на [`PyUnicodeWriter_Finish(writer)`](https://python-all.ru/3.14/c-api/unicode.html#c.PyUnicodeWriter_Finish).297  - `_PyUnicodeWriter_Dealloc()`: заменить `_PyUnicodeWriter_Dealloc(&writer)` на [`PyUnicodeWriter_Discard(writer)`](https://python-all.ru/3.14/c-api/unicode.html#c.PyUnicodeWriter_Discard).298  - `_PyUnicodeWriter_WriteChar()`: заменить `_PyUnicodeWriter_WriteChar(&writer, ch)` на [`PyUnicodeWriter_WriteChar(writer, ch)`](https://python-all.ru/3.14/c-api/unicode.html#c.PyUnicodeWriter_WriteChar).299  - `_PyUnicodeWriter_WriteStr()`: заменить `_PyUnicodeWriter_WriteStr(&writer, str)` на [`PyUnicodeWriter_WriteStr(writer, str)`](https://python-all.ru/3.14/c-api/unicode.html#c.PyUnicodeWriter_WriteStr).300  - `_PyUnicodeWriter_WriteSubstring()`: заменить `_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)` на [`PyUnicodeWriter_WriteSubstring(writer, str, start, end)`](https://python-all.ru/3.14/c-api/unicode.html#c.PyUnicodeWriter_WriteSubstring).301  - `_PyUnicodeWriter_WriteASCIIString()`: заменить `_PyUnicodeWriter_WriteASCIIString(&writer, str)` на [`PyUnicodeWriter_WriteASCII(writer, str)`](https://python-all.ru/3.14/c-api/unicode.html#c.PyUnicodeWriter_WriteASCII).302  - `_PyUnicodeWriter_WriteLatin1String()`: заменить `_PyUnicodeWriter_WriteLatin1String(&writer, str)` на [`PyUnicodeWriter_WriteUTF8(writer, str)`](https://python-all.ru/3.14/c-api/unicode.html#c.PyUnicodeWriter_WriteUTF8).303  - `_PyUnicodeWriter_Prepare()`: (нет замены).304  - `_PyUnicodeWriter_PrepareKind()`: (нет замены).305  - `_Py_HashPointer()`: используйте [`Py_HashPointer()`](https://python-all.ru/3.14/c-api/hash.html#c.Py_HashPointer).306  - `_Py_fopen_obj()`: используйте [`Py_fopen()`](https://python-all.ru/3.14/c-api/sys.html#c.Py_fopen).307308  Проект [pythoncapi-compat](https://python-all.ru/3.14/deprecations/index.html) можно использовать для получения этих новых открытых функций в Python 3.13 и старше. (Предложено Виктором Стиннером в [gh-128863](https://python-all.ru/3.14/deprecations/index.html).)309310### Будет удалено в будущих версиях311312Следующие API устарели и будут удалены, хотя на данный момент дата их удаления не назначена.313314- [`Py_TPFLAGS_HAVE_FINALIZE`](https://python-all.ru/3.14/c-api/typeobj.html#c.Py_TPFLAGS_HAVE_FINALIZE): Не требуется начиная с Python 3.8.315- [`PyErr_Fetch()`](https://python-all.ru/3.14/c-api/exceptions.html#c.PyErr_Fetch): Вместо этого используйте [`PyErr_GetRaisedException()`](https://python-all.ru/3.14/c-api/exceptions.html#c.PyErr_GetRaisedException).316- [`PyErr_NormalizeException()`](https://python-all.ru/3.14/c-api/exceptions.html#c.PyErr_NormalizeException): Вместо этого используйте [`PyErr_GetRaisedException()`](https://python-all.ru/3.14/c-api/exceptions.html#c.PyErr_GetRaisedException).317- [`PyErr_Restore()`](https://python-all.ru/3.14/c-api/exceptions.html#c.PyErr_Restore): Вместо этого используйте [`PyErr_SetRaisedException()`](https://python-all.ru/3.14/c-api/exceptions.html#c.PyErr_SetRaisedException).318- [`PyModule_GetFilename()`](https://python-all.ru/3.14/c-api/module.html#c.PyModule_GetFilename): Вместо этого используйте [`PyModule_GetFilenameObject()`](https://python-all.ru/3.14/c-api/module.html#c.PyModule_GetFilenameObject).319- [`PyOS_AfterFork()`](https://python-all.ru/3.14/c-api/sys.html#c.PyOS_AfterFork): Вместо этого используйте [`PyOS_AfterFork_Child()`](https://python-all.ru/3.14/c-api/sys.html#c.PyOS_AfterFork_Child).320- [`PySlice_GetIndicesEx()`](https://python-all.ru/3.14/c-api/slice.html#c.PySlice_GetIndicesEx): Вместо этого используйте [`PySlice_Unpack()`](https://python-all.ru/3.14/c-api/slice.html#c.PySlice_Unpack) и [`PySlice_AdjustIndices()`](https://python-all.ru/3.14/c-api/slice.html#c.PySlice_AdjustIndices).321- [`PyUnicode_READY()`](https://python-all.ru/3.14/c-api/unicode.html#c.PyUnicode_READY): Не требуется начиная с Python 3.12322- `PyErr_Display()`: Вместо этого используйте [`PyErr_DisplayException()`](https://python-all.ru/3.14/c-api/exceptions.html#c.PyErr_DisplayException).323- `_PyErr_ChainExceptions()`: Вместо этого используйте `_PyErr_ChainExceptions1()`.324- Элемент `PyBytesObject.ob_shash`: вместо этого вызывайте [`PyObject_Hash()`](https://python-all.ru/3.14/c-api/object.html#c.PyObject_Hash).325- API локального хранилища потока (TLS):326327  - [`PyThread_create_key()`](https://python-all.ru/3.14/c-api/tls.html#c.PyThread_create_key): Вместо этого используйте [`PyThread_tss_alloc()`](https://python-all.ru/3.14/c-api/tls.html#c.PyThread_tss_alloc).328  - [`PyThread_delete_key()`](https://python-all.ru/3.14/c-api/tls.html#c.PyThread_delete_key): Вместо этого используйте [`PyThread_tss_free()`](https://python-all.ru/3.14/c-api/tls.html#c.PyThread_tss_free).329  - [`PyThread_set_key_value()`](https://python-all.ru/3.14/c-api/tls.html#c.PyThread_set_key_value): Вместо этого используйте [`PyThread_tss_set()`](https://python-all.ru/3.14/c-api/tls.html#c.PyThread_tss_set).330  - [`PyThread_get_key_value()`](https://python-all.ru/3.14/c-api/tls.html#c.PyThread_get_key_value): Вместо этого используйте [`PyThread_tss_get()`](https://python-all.ru/3.14/c-api/tls.html#c.PyThread_tss_get).331  - [`PyThread_delete_key_value()`](https://python-all.ru/3.14/c-api/tls.html#c.PyThread_delete_key_value): Вместо этого используйте [`PyThread_tss_delete()`](https://python-all.ru/3.14/c-api/tls.html#c.PyThread_tss_delete).332  - [`PyThread_ReInitTLS()`](https://python-all.ru/3.14/c-api/tls.html#c.PyThread_ReInitTLS): Не требуется с Python 3.7.333