> **Источник:** https://python-all.ru/3/deprecations/index.html
>
> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.

---

# Устаревания

## Ожидается удаление в Python 3.15

- Система импорта:

  - Установка [`__cached__`](https://python-all.ru/3/reference/datamodel.html#module.__cached__) в модуле без установки [`__spec__.cached`](https://python-all.ru/3/library/importlib.html#importlib.machinery.ModuleSpec.cached) считается устаревшей. Начиная с Python 3.15 `__cached__` больше не будет устанавливаться или учитываться системой импорта или стандартной библиотекой. ([gh-97879](https://python-all.ru/3/deprecations/index.html))
  - Установка [`__package__`](https://python-all.ru/3/reference/datamodel.html#module.__package__) в модуле без установки [`__spec__.parent`](https://python-all.ru/3/library/importlib.html#importlib.machinery.ModuleSpec.parent) считается устаревшей. Начиная с Python 3.15 `__package__` больше не будет устанавливаться или учитываться системой импорта или стандартной библиотекой. ([gh-97879](https://python-all.ru/3/deprecations/index.html))
- [`ctypes`](https://python-all.ru/3/library/ctypes.html#module-ctypes):

  - Незадокументированная функция `ctypes.SetPointerType()` считается устаревшей начиная с Python 3.13.
- [`http.server`](https://python-all.ru/3/library/http.server.html#module-http.server):

  - Устаревшая и редко используемая [`CGIHTTPRequestHandler`](https://python-all.ru/3/library/http.server.html#http.server.CGIHTTPRequestHandler) считается устаревшей начиная с Python 3.13. Прямой замены не существует. *Что угодно* лучше, чем CGI, для взаимодействия веб-сервера с обработчиком запросов.
  - Флаг `--cgi` для **python -m http.server** интерфейса командной строки считается устаревшим начиная с Python 3.13.
- [`importlib`](https://python-all.ru/3/library/importlib.html#module-importlib):

  - Метод `load_module()`: вместо него используйте `exec_module()`.
- [`pathlib`](https://python-all.ru/3/library/pathlib.html#module-pathlib):

  - [`PurePath.is_reserved()`](https://python-all.ru/3/library/pathlib.html#pathlib.PurePath.is_reserved) считается устаревшим начиная с Python 3.13. Используйте [`os.path.isreserved()`](https://python-all.ru/3/library/os.path.html#os.path.isreserved) для обнаружения зарезервированных путей в Windows.
- [`platform`](https://python-all.ru/3/library/platform.html#module-platform):

  - [`java_ver()`](https://python-all.ru/3/library/platform.html#platform.java_ver) считается устаревшим начиная с Python 3.13. Эта функция полезна только для поддержки Jython, имеет запутанный API и в значительной степени не тестировалась.
- [`sysconfig`](https://python-all.ru/3/library/sysconfig.html#module-sysconfig):

  - Аргумент *check\_home* функции [`sysconfig.is_python_build()`](https://python-all.ru/3/library/sysconfig.html#sysconfig.is_python_build) считается устаревшим начиная с Python 3.12.
- [`threading`](https://python-all.ru/3/library/threading.html#module-threading):

  - [`RLock()`](https://python-all.ru/3/library/threading.html#threading.RLock) не будет принимать аргументов в Python 3.15. Передача любых аргументов считается устаревшей начиная с Python 3.14, поскольку версия на Python не допускает никаких аргументов, но версия на C позволяет любое количество позиционных или именованных аргументов, игнорируя все аргументы.
- [`types`](https://python-all.ru/3/library/types.html#module-types):

  - [`types.CodeType`](https://python-all.ru/3/library/types.html#types.CodeType): доступ к [`co_lnotab`](https://python-all.ru/3/reference/datamodel.html#codeobject.co_lnotab) был объявлен устаревшим в [**PEP 626**](https://python-all.ru/3/deprecations/index.html) начиная с версии 3.10 и планировался к удалению в 3.12, но получил надлежащий [`DeprecationWarning`](https://python-all.ru/3/library/exceptions.html#DeprecationWarning) только в 3.12. Может быть удалён в 3.15. (Предложено Никитой Соболевым в [gh-101866](https://python-all.ru/3/deprecations/index.html).)
- [`typing`](https://python-all.ru/3/library/typing.html#module-typing):

  - Незадокументированный синтаксис именованных аргументов для создания классов [`NamedTuple`](https://python-all.ru/3/library/typing.html#typing.NamedTuple) (например, `Point = NamedTuple("Point", x=int, y=int)`) считается устаревшим начиная с Python 3.13. Вместо этого используйте синтаксис на основе классов или функциональный синтаксис.
  - При использовании функционального синтаксиса [`TypedDict`](https://python-all.ru/3/library/typing.html#typing.TypedDict), отсутствие передачи значения параметру *поля* (`TD = TypedDict("TD")`) или передача `None` (`TD = TypedDict("TD", None)`) считается устаревшим начиная с Python 3.13. Используйте `class TD(TypedDict): pass` или `TD = TypedDict("TD", {})` для создания TypedDict без полей.
  - Функция-декоратор [`typing.no_type_check_decorator()`](https://python-all.ru/3/library/typing.html#typing.no_type_check_decorator) считается устаревшей начиная с Python 3.13. За восемь лет в модуле [`typing`](https://python-all.ru/3/library/typing.html#module-typing) она так и не была поддержана ни одним крупным средством проверки типов.
- [`wave`](https://python-all.ru/3/library/wave.html#module-wave):

  - Методы [`getmark()`](https://python-all.ru/3/library/wave.html#wave.Wave_read.getmark), `setmark()` и [`getmarkers()`](https://python-all.ru/3/library/wave.html#wave.Wave_read.getmarkers) классов [`Wave_read`](https://python-all.ru/3/library/wave.html#wave.Wave_read) и [`Wave_write`](https://python-all.ru/3/library/wave.html#wave.Wave_write) устарели начиная с Python 3.13.
- [`zipimport`](https://python-all.ru/3/library/zipimport.html#module-zipimport):

  - [`load_module()`](https://python-all.ru/3/library/zipimport.html#zipimport.zipimporter.load_module) устарел начиная с Python 3.10. Вместо него используйте [`exec_module()`](https://python-all.ru/3/library/zipimport.html#zipimport.zipimporter.exec_module). (Внёс вклад Jiahao Li в [gh-125746](https://python-all.ru/3/deprecations/index.html).)

## Запланировано к удалению в Python 3.16

- Система импорта:

  - Установка [`__loader__`](https://python-all.ru/3/reference/datamodel.html#module.__loader__) в модуле при отсутствии [`__spec__.loader`](https://python-all.ru/3/library/importlib.html#importlib.machinery.ModuleSpec.loader) устарела. В Python 3.16 `__loader__` перестанет устанавливаться или учитываться системой импорта или стандартной библиотекой.
- [`array`](https://python-all.ru/3/library/array.html#module-array):

  - Код формата `'u'` (`wchar_t`) устарел в документации начиная с Python 3.3 и во время выполнения начиная с Python 3.13. Используйте код формата `'w'` ([`Py_UCS4`](https://python-all.ru/3/c-api/unicode.html#c.Py_UCS4)) для символов Unicode.
- [`asyncio`](https://python-all.ru/3/library/asyncio.html#module-asyncio):

  - `asyncio.iscoroutinefunction()` устарело и будет удалено в Python 3.16; используйте [`inspect.iscoroutinefunction()`](https://python-all.ru/3/library/inspect.html#inspect.iscoroutinefunction) вместо этого. (Предложено Jiahao Li и Kumar Aditya в [gh-122875](https://python-all.ru/3/deprecations/index.html).)
  - Система политик [`asyncio`](https://python-all.ru/3/library/asyncio.html#module-asyncio) устарела и будет удалена в Python 3.16. В частности, следующие классы и функции устарели:

    - [`asyncio.AbstractEventLoopPolicy`](https://python-all.ru/3/library/asyncio-policy.html#asyncio.AbstractEventLoopPolicy)
    - [`asyncio.DefaultEventLoopPolicy`](https://python-all.ru/3/library/asyncio-policy.html#asyncio.DefaultEventLoopPolicy)
    - [`asyncio.WindowsSelectorEventLoopPolicy`](https://python-all.ru/3/library/asyncio-policy.html#asyncio.WindowsSelectorEventLoopPolicy)
    - [`asyncio.WindowsProactorEventLoopPolicy`](https://python-all.ru/3/library/asyncio-policy.html#asyncio.WindowsProactorEventLoopPolicy)
    - [`asyncio.get_event_loop_policy()`](https://python-all.ru/3/library/asyncio-policy.html#asyncio.get_event_loop_policy)
    - [`asyncio.set_event_loop_policy()`](https://python-all.ru/3/library/asyncio-policy.html#asyncio.set_event_loop_policy)

    Для использования нужной реализации цикла событий следует применять [`asyncio.run()`](https://python-all.ru/3/library/asyncio-runner.html#asyncio.run) или [`asyncio.Runner`](https://python-all.ru/3/library/asyncio-runner.html#asyncio.Runner) с параметром *loop\_factory*.

    Например, чтобы использовать [`asyncio.SelectorEventLoop`](https://python-all.ru/3/library/asyncio-eventloop.html#asyncio.SelectorEventLoop) в Windows:

    ```python
    import asyncio

    async def main():
        ...

    asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)
    ```

    (Предложено Kumar Aditya в [gh-127949](https://python-all.ru/3/deprecations/index.html).)
- [`builtins`](https://python-all.ru/3/library/builtins.html#module-builtins):

  - Поразрядная инверсия для булевых типов, `~True` или `~False` устарела начиная с Python 3.12, поскольку даёт неожиданные и неинтуитивные результаты (`-2` и `-1`). Используйте `not x` для логического отрицания булевого значения. В редких случаях, когда требуется поразрядная инверсия базового целого числа, явно преобразуйте в `int` (`~int(x)`).
- [`functools`](https://python-all.ru/3/library/functools.html#module-functools):

  - Вызов реализации [`functools.reduce()`](https://python-all.ru/3/library/functools.html#functools.reduce) на Python с *function* или *sequence* в качестве именованных аргументов устарел начиная с Python 3.14.
- [`logging`](https://python-all.ru/3/library/logging.html#module-logging):

  Поддержка пользовательских обработчиков логирования с аргументом *strm* устарела и запланирована к удалению в Python 3.16. Вместо этого определяйте обработчики с аргументом *stream*. (Предложено Mariusz Felisiak в [gh-115032](https://python-all.ru/3/deprecations/index.html).)
- [`mimetypes`](https://python-all.ru/3/library/mimetypes.html#module-mimetypes):

  - Допустимые расширения начинаются с точки ‘.’ или пусты для [`mimetypes.MimeTypes.add_type()`](https://python-all.ru/3/library/mimetypes.html#mimetypes.MimeTypes.add_type). Расширения без точки устарели и будут вызывать [`ValueError`](https://python-all.ru/3/library/exceptions.html#ValueError) в Python 3.16. (Предложено Hugo van Kemenade в [gh-75223](https://python-all.ru/3/deprecations/index.html).)
- [`shutil`](https://python-all.ru/3/library/shutil.html#module-shutil):

  - Исключение `ExecError` устарело начиная с Python 3.14. Оно не используется ни одной функцией в `shutil` начиная с Python 3.4 и теперь является псевдонимом [`RuntimeError`](https://python-all.ru/3/library/exceptions.html#RuntimeError).
- [`symtable`](https://python-all.ru/3/library/symtable.html#module-symtable):

  - Метод [`Class.get_methods`](https://python-all.ru/3/library/symtable.html#symtable.Class.get_methods) устарел начиная с Python 3.14.
- [`sys`](https://python-all.ru/3/library/sys.html#module-sys):

  - Функция [`_enablelegacywindowsfsencoding()`](https://python-all.ru/3/library/sys.html#sys._enablelegacywindowsfsencoding) устарела начиная с Python 3.13. Используйте переменную окружения [`PYTHONLEGACYWINDOWSFSENCODING`](https://python-all.ru/3/using/cmdline.html#envvar-PYTHONLEGACYWINDOWSFSENCODING).
- [`sysconfig`](https://python-all.ru/3/library/sysconfig.html#module-sysconfig):

  - Функция `sysconfig.expand_makefile_vars()` устарела начиная с Python 3.14. Используйте аргумент `vars` из [`sysconfig.get_paths()`](https://python-all.ru/3/library/sysconfig.html#sysconfig.get_paths).
- [`tarfile`](https://python-all.ru/3/library/tarfile.html#module-tarfile):

  - Недокументированный и неиспользуемый атрибут `TarFile.tarfile` устарел начиная с Python 3.13.

## Запланировано к удалению в Python 3.17

- [`collections.abc`](https://python-all.ru/3/library/collections.abc.html#module-collections.abc):

  - [`collections.abc.ByteString`](https://python-all.ru/3/library/collections.abc.html#collections.abc.ByteString) запланирован к удалению в Python 3.17.

    Используйте `isinstance(obj, collections.abc.Buffer)` для проверки, реализует ли `obj` [протокол буфера](https://python-all.ru/3/c-api/buffer.html#bufferobjects) во время выполнения. Для использования в аннотациях типов используйте [`Buffer`](https://python-all.ru/3/library/collections.abc.html#collections.abc.Buffer) или объединение, которое явно указывает типы, поддерживаемые вашим кодом (например, `bytes | bytearray | memoryview`).

    `ByteString` изначально задумывался как абстрактный класс, который должен был служить супертипом как для [`bytes`](https://python-all.ru/3/library/stdtypes.html#bytes), так и для [`bytearray`](https://python-all.ru/3/library/stdtypes.html#bytearray). Однако, поскольку у ABC никогда не было методов, знание того, что объект является экземпляром `ByteString`, никогда не давало полезной информации об объекте. Другие распространённые типы буферов, такие как [`memoryview`](https://python-all.ru/3/library/stdtypes.html#memoryview), также никогда не рассматривались как подтипы `ByteString` (ни во время выполнения, ни статическими проверками типов).

    См. [**PEP 688**](https://python-all.ru/3/deprecations/index.html) для получения подробностей. (Автор: Shantanu Jain в [gh-91896](https://python-all.ru/3/deprecations/index.html).)
- [`typing`](https://python-all.ru/3/library/typing.html#module-typing):

  - До Python 3.14 старые объединения реализовывались с помощью приватного класса `typing._UnionGenericAlias`. Этот класс больше не нужен для реализации, но он сохранён для обратной совместимости, его удаление запланировано на Python 3.17. Пользователям следует использовать документированные вспомогательные средства интроспекции, такие как [`typing.get_origin()`](https://python-all.ru/3/library/typing.html#typing.get_origin) и [`typing.get_args()`](https://python-all.ru/3/library/typing.html#typing.get_args), вместо того чтобы полагаться на детали приватной реализации.
  - [`typing.ByteString`](https://python-all.ru/3/library/typing.html#typing.ByteString), устаревший с Python 3.9, запланирован к удалению в Python 3.17.

    Используйте `isinstance(obj, collections.abc.Buffer)` для проверки, реализует ли `obj` [протокол буфера](https://python-all.ru/3/c-api/buffer.html#bufferobjects) во время выполнения. Для использования в аннотациях типов используйте [`Buffer`](https://python-all.ru/3/library/collections.abc.html#collections.abc.Buffer) или объединение, которое явно указывает типы, поддерживаемые вашим кодом (например, `bytes | bytearray | memoryview`).

    `ByteString` изначально задумывался как абстрактный класс, который должен был служить супертипом как для [`bytes`](https://python-all.ru/3/library/stdtypes.html#bytes), так и для [`bytearray`](https://python-all.ru/3/library/stdtypes.html#bytearray). Однако, поскольку у ABC никогда не было методов, знание того, что объект является экземпляром `ByteString`, никогда не давало полезной информации об объекте. Другие распространённые типы буферов, такие как [`memoryview`](https://python-all.ru/3/library/stdtypes.html#memoryview), также никогда не рассматривались как подтипы `ByteString` (ни во время выполнения, ни статическими проверками типов).

    См. [**PEP 688**](https://python-all.ru/3/deprecations/index.html) для получения подробностей. (Автор: Shantanu Jain в [gh-91896](https://python-all.ru/3/deprecations/index.html).)

## Запланировано удаление в Python 3.18

- [`decimal`](https://python-all.ru/3/library/decimal.html#module-decimal):

  - Нестандартный и недокументированный [`Decimal`](https://python-all.ru/3/library/decimal.html#decimal.Decimal) спецификатор формата `'N'`, который поддерживается только в реализации C модуля `decimal`, устарел с Python 3.13. (Автор: Serhiy Storchaka в [gh-89902](https://python-all.ru/3/deprecations/index.html).)

## Запланировано к удалению в Python 3.19

- [`ctypes`](https://python-all.ru/3/library/ctypes.html#module-ctypes):

  - Неявное переключение на совместимую с MSVC структуру путём установки [`_pack_`](https://python-all.ru/3/library/ctypes.html#ctypes.Structure._pack_) без [`_layout_`](https://python-all.ru/3/library/ctypes.html#ctypes.Structure._layout_) на платформах, отличных от Windows.

## Будет удалено в будущих версиях

Следующие API будут удалены в будущем, хотя на данный момент нет запланированной даты их удаления.

- [`argparse`](https://python-all.ru/3/library/argparse.html#module-argparse):

  - Вложение групп аргументов и вложение взаимоисключающих групп устарело.
  - Передача недокументированного именованного аргумента *prefix\_chars* в [`add_argument_group()`](https://python-all.ru/3/library/argparse.html#argparse.ArgumentParser.add_argument_group) теперь устарела.
  - Конвертер типов [`argparse.FileType`](https://python-all.ru/3/library/argparse.html#argparse.FileType) устарел.
- [`builtins`](https://python-all.ru/3/library/builtins.html#module-builtins):

  - Генераторы: сигнатура `throw(type, exc, tb)` и `athrow(type, exc, tb)` устарела: используйте `throw(exc)` и `athrow(exc)` вместо неё, сигнатуру с одним аргументом.
  - В настоящее время 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/reference/expressions.html#and), [`else`](https://python-all.ru/3/reference/compound_stmts.html#else), [`for`](https://python-all.ru/3/reference/compound_stmts.html#for), [`if`](https://python-all.ru/3/reference/compound_stmts.html#if), [`in`](https://python-all.ru/3/reference/expressions.html#in), [`is`](https://python-all.ru/3/reference/expressions.html#is) и [`or`](https://python-all.ru/3/reference/expressions.html#or). В будущем выпуске это будет изменено на синтаксическую ошибку. ([gh-87999](https://python-all.ru/3/deprecations/index.html))
  - Поддержка методов `__index__()` и `__int__()`, возвращающих не-int тип: эти методы должны будут возвращать экземпляр строгого подкласса [`int`](https://python-all.ru/3/library/functions.html#int).
  - Поддержка метода `__float__()`, возвращающего строгий подкласс [`float`](https://python-all.ru/3/library/functions.html#float): эти методы должны будут возвращать экземпляр `float`.
  - Поддержка метода `__complex__()`, возвращающего строгий подкласс [`complex`](https://python-all.ru/3/library/functions.html#complex): эти методы должны будут возвращать экземпляр `complex`.
  - Передача комплексного числа в качестве аргумента *real* или *imag* в конструкторе [`complex()`](https://python-all.ru/3/library/functions.html#complex) теперь устарела; его следует передавать только как единственный позиционный аргумент. (Автор: Сергей Сторчака в [gh-109218](https://python-all.ru/3/deprecations/index.html).)
- [`calendar`](https://python-all.ru/3/library/calendar.html#module-calendar): константы `calendar.January` и `calendar.February` устарели и заменены на [`calendar.JANUARY`](https://python-all.ru/3/library/calendar.html#calendar.JANUARY) и [`calendar.FEBRUARY`](https://python-all.ru/3/library/calendar.html#calendar.FEBRUARY). (Автор: Prince Roshan в [gh-103636](https://python-all.ru/3/deprecations/index.html).)
- [`codecs`](https://python-all.ru/3/library/codecs.html#module-codecs): используйте [`open()`](https://python-all.ru/3/library/functions.html#open) вместо [`codecs.open()`](https://python-all.ru/3/library/codecs.html#codecs.open). ([gh-133038](https://python-all.ru/3/deprecations/index.html))
- [`codeobject.co_lnotab`](https://python-all.ru/3/reference/datamodel.html#codeobject.co_lnotab): используйте метод [`codeobject.co_lines()`](https://python-all.ru/3/reference/datamodel.html#codeobject.co_lines) вместо этого.
- [`datetime`](https://python-all.ru/3/library/datetime.html#module-datetime):

  - [`utcnow()`](https://python-all.ru/3/library/datetime.html#datetime.datetime.utcnow): используйте `datetime.datetime.now(tz=datetime.UTC)`.
  - [`utcfromtimestamp()`](https://python-all.ru/3/library/datetime.html#datetime.datetime.utcfromtimestamp): используйте `datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)`.
- [`gettext`](https://python-all.ru/3/library/gettext.html#module-gettext): значение множественного числа должно быть целым числом.
- [`importlib`](https://python-all.ru/3/library/importlib.html#module-importlib):

  - [`cache_from_source()`](https://python-all.ru/3/library/importlib.html#importlib.util.cache_from_source): параметр *debug\_override* устарел: используйте параметр *optimization* вместо него.
- [`importlib.metadata`](https://python-all.ru/3/library/importlib.metadata.html#module-importlib.metadata):

  - `EntryPoints`: интерфейс кортежа.
  - Неявное `None` для возвращаемых значений.
- [`logging`](https://python-all.ru/3/library/logging.html#module-logging): метод `warn()` устарел начиная с Python 3.3, используйте [`warning()`](https://python-all.ru/3/library/logging.html#logging.warning) вместо него.
- [`mailbox`](https://python-all.ru/3/library/mailbox.html#module-mailbox): использование StringIO в режиме ввода и текстовом режиме устарело, используйте BytesIO и двоичный режим.
- [`os`](https://python-all.ru/3/library/os.html#module-os): вызов [`os.register_at_fork()`](https://python-all.ru/3/library/os.html#os.register_at_fork) в многопоточном процессе.
- `pydoc.ErrorDuringImport`: кортежное значение для параметра *exc\_info* устарело, используйте экземпляр исключения.
- [`re`](https://python-all.ru/3/library/re.html#module-re): теперь применяются более строгие правила для числовых ссылок на группы и имён групп в регулярных выражениях. В качестве числовой ссылки теперь принимается только последовательность цифр ASCII. Имя группы в байтовых шаблонах и строках замены теперь может содержать только буквы ASCII, цифры и знак подчёркивания. (Автор: Сергей Сторчака в [gh-91760](https://python-all.ru/3/deprecations/index.html).)
- Модули `sre_compile`, `sre_constants` и `sre_parse`.
- [`shutil`](https://python-all.ru/3/library/shutil.html#module-shutil): параметр *onerror* метода [`rmtree()`](https://python-all.ru/3/library/shutil.html#shutil.rmtree) устарел в Python 3.12; используйте параметр *onexc* вместо него.
- [`ssl`](https://python-all.ru/3/library/ssl.html#module-ssl): опции и протоколы:

  - [`ssl.SSLContext`](https://python-all.ru/3/library/ssl.html#ssl.SSLContext) без аргумента протокол устарело.
  - [`ssl.SSLContext`](https://python-all.ru/3/library/ssl.html#ssl.SSLContext): [`set_npn_protocols()`](https://python-all.ru/3/library/ssl.html#ssl.SSLContext.set_npn_protocols) и `selected_npn_protocol()` устарели: используйте ALPN вместо них.
  - `ssl.OP_NO_SSL*`: опции
  - `ssl.OP_NO_TLS*`: опции
  - `ssl.PROTOCOL_SSLv3`
  - `ssl.PROTOCOL_TLS`
  - `ssl.PROTOCOL_TLSv1`
  - `ssl.PROTOCOL_TLSv1_1`
  - `ssl.PROTOCOL_TLSv1_2`
  - `ssl.TLSVersion.SSLv3`
  - `ssl.TLSVersion.TLSv1`
  - `ssl.TLSVersion.TLSv1_1`
- [`threading`](https://python-all.ru/3/library/threading.html#module-threading): методы

  - `threading.Condition.notifyAll()`: используйте [`notify_all()`](https://python-all.ru/3/library/threading.html#threading.Condition.notify_all).
  - `threading.Event.isSet()`: используйте [`is_set()`](https://python-all.ru/3/library/threading.html#threading.Event.is_set).
  - `threading.Thread.isDaemon()`, [`threading.Thread.setDaemon()`](https://python-all.ru/3/library/threading.html#threading.Thread.setDaemon): используйте атрибут [`threading.Thread.daemon`](https://python-all.ru/3/library/threading.html#threading.Thread.daemon).
  - `threading.Thread.getName()`, [`threading.Thread.setName()`](https://python-all.ru/3/library/threading.html#threading.Thread.setName): используйте атрибут [`threading.Thread.name`](https://python-all.ru/3/library/threading.html#threading.Thread.name).
  - `threading.currentThread()`: используйте [`threading.current_thread()`](https://python-all.ru/3/library/threading.html#threading.current_thread).
  - `threading.activeCount()`: используйте [`threading.active_count()`](https://python-all.ru/3/library/threading.html#threading.active_count).
- [`typing.Text`](https://python-all.ru/3/library/typing.html#typing.Text) ([gh-92332](https://python-all.ru/3/deprecations/index.html)).
- Внутренний класс `typing._UnionGenericAlias` больше не используется для реализации [`typing.Union`](https://python-all.ru/3/library/typing.html#typing.Union). Для сохранения совместимости с пользователями, использующими этот закрытый класс, будет предоставлена прослойка совместимости как минимум до Python 3.17. (Автор: Jelle Zijlstra, [gh-105499](https://python-all.ru/3/deprecations/index.html).)
- [`unittest.IsolatedAsyncioTestCase`](https://python-all.ru/3/library/unittest.html#unittest.IsolatedAsyncioTestCase): возврат значения, не являющегося `None`, из тестового примера устарел.
- [`urllib.parse`](https://python-all.ru/3/library/urllib.parse.html#module-urllib.parse) устаревшие функции: используйте [`urlparse()`](https://python-all.ru/3/library/urllib.parse.html#urllib.parse.urlparse) вместо них.

  - `splitattr()`
  - `splithost()`
  - `splitnport()`
  - `splitpasswd()`
  - `splitport()`
  - `splitquery()`
  - `splittag()`
  - `splittype()`
  - `splituser()`
  - `splitvalue()`
  - `to_bytes()`
- [`wsgiref`](https://python-all.ru/3/library/wsgiref.html#module-wsgiref): `SimpleHandler.stdout.write()` не должна выполнять частичную запись.
- [`xml.etree.ElementTree`](https://python-all.ru/3/library/xml.etree.elementtree.html#module-xml.etree.ElementTree): проверка истинностного значения [`Element`](https://python-all.ru/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element) устарела. В будущем выпуске она всегда будет возвращать `True`. Вместо этого используйте явные проверки `len(elem)` или `elem is not None`.
- [`sys._clear_type_cache()`](https://python-all.ru/3/library/sys.html#sys._clear_type_cache) устарело: используйте [`sys._clear_internal_caches()`](https://python-all.ru/3/library/sys.html#sys._clear_internal_caches) вместо него.

## Устаревания в C API

### Ожидается удаление в Python 3.15

- [`PyImport_ImportModuleNoBlock()`](https://python-all.ru/3/c-api/import.html#c.PyImport_ImportModuleNoBlock): Вместо этого используйте [`PyImport_ImportModule()`](https://python-all.ru/3/c-api/import.html#c.PyImport_ImportModule).
- [`PyWeakref_GetObject()`](https://python-all.ru/3/c-api/weakref.html#c.PyWeakref_GetObject) и [`PyWeakref_GET_OBJECT()`](https://python-all.ru/3/c-api/weakref.html#c.PyWeakref_GET_OBJECT): Вместо этого используйте [`PyWeakref_GetRef()`](https://python-all.ru/3/c-api/weakref.html#c.PyWeakref_GetRef). Проект [pythoncapi-compat](https://python-all.ru/3/deprecations/index.html) можно использовать, чтобы получить `PyWeakref_GetRef()` на Python 3.12 и старше.
- Тип [`Py_UNICODE`](https://python-all.ru/3/c-api/unicode.html#c.Py_UNICODE) и макрос `Py_UNICODE_WIDE`: Вместо них используйте `wchar_t`.
- `PyUnicode_AsDecodedObject()`: Вместо этого используйте [`PyCodec_Decode()`](https://python-all.ru/3/c-api/codec.html#c.PyCodec_Decode).
- `PyUnicode_AsDecodedUnicode()`: Вместо этого используйте [`PyCodec_Decode()`](https://python-all.ru/3/c-api/codec.html#c.PyCodec_Decode); Обратите внимание, что некоторые кодеки (например, «base64») могут возвращать тип, отличный от [`str`](https://python-all.ru/3/library/stdtypes.html#str), например, [`bytes`](https://python-all.ru/3/library/stdtypes.html#bytes).
- `PyUnicode_AsEncodedObject()`: Вместо этого используйте [`PyCodec_Encode()`](https://python-all.ru/3/c-api/codec.html#c.PyCodec_Encode).
- `PyUnicode_AsEncodedUnicode()`: Вместо этого используйте [`PyCodec_Encode()`](https://python-all.ru/3/c-api/codec.html#c.PyCodec_Encode); Обратите внимание, что некоторые кодеки (например, «base64») могут возвращать тип, отличный от [`bytes`](https://python-all.ru/3/library/stdtypes.html#bytes), например, [`str`](https://python-all.ru/3/library/stdtypes.html#str).
- Функции инициализации Python, устаревшие в Python 3.13:

  - [`Py_GetPath()`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_GetPath): Вместо этого используйте [`PyConfig_Get("module_search_paths")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) ([`sys.path`](https://python-all.ru/3/library/sys.html#sys.path)).
  - [`Py_GetPrefix()`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_GetPrefix): Вместо этого используйте [`PyConfig_Get("base_prefix")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) ([`sys.base_prefix`](https://python-all.ru/3/library/sys.html#sys.base_prefix)). Используйте `PyConfig_Get("prefix")` ([`sys.prefix`](https://python-all.ru/3/library/sys.html#sys.prefix)), если необходимо обрабатывать [виртуальные окружения](https://python-all.ru/3/library/venv.html#venv-def).
  - [`Py_GetExecPrefix()`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_GetExecPrefix): Вместо этого используйте [`PyConfig_Get("base_exec_prefix")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) ([`sys.base_exec_prefix`](https://python-all.ru/3/library/sys.html#sys.base_exec_prefix)). Используйте `PyConfig_Get("exec_prefix")` ([`sys.exec_prefix`](https://python-all.ru/3/library/sys.html#sys.exec_prefix)), если необходимо обрабатывать [виртуальные окружения](https://python-all.ru/3/library/venv.html#venv-def).
  - [`Py_GetProgramFullPath()`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_GetProgramFullPath): Вместо этого используйте [`PyConfig_Get("executable")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) ([`sys.executable`](https://python-all.ru/3/library/sys.html#sys.executable)).
  - [`Py_GetProgramName()`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_GetProgramName): Вместо этого используйте [`PyConfig_Get("executable")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) ([`sys.executable`](https://python-all.ru/3/library/sys.html#sys.executable)).
  - [`Py_GetPythonHome()`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_GetPythonHome): Используйте [`PyConfig_Get("home")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) или переменную окружения [`PYTHONHOME`](https://python-all.ru/3/using/cmdline.html#envvar-PYTHONHOME).

  Проект [pythoncapi-compat](https://python-all.ru/3/deprecations/index.html) можно использовать, чтобы получить [`PyConfig_Get()`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) на Python 3.13 и старше.
- Функции для настройки инициализации Python, устаревшие в Python 3.11:

  - `PySys_SetArgvEx()`: Вместо этого задайте [`PyConfig.argv`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.argv).
  - `PySys_SetArgv()`: Вместо этого задайте [`PyConfig.argv`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.argv).
  - `Py_SetProgramName()`: Вместо этого задайте [`PyConfig.program_name`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.program_name).
  - `Py_SetPythonHome()`: Вместо этого задайте [`PyConfig.home`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.home).
  - [`PySys_ResetWarnOptions()`](https://python-all.ru/3/c-api/sys.html#c.PySys_ResetWarnOptions): Очищайте [`sys.warnoptions`](https://python-all.ru/3/library/sys.html#sys.warnoptions) и `warnings.filters`.

  API [`Py_InitializeFromConfig()`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_InitializeFromConfig) следует использовать с [`PyConfig`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig) вместо этого.
- Глобальные переменные конфигурации:

  - [`Py_DebugFlag`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_DebugFlag): Используйте [`PyConfig.parser_debug`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.parser_debug) или [`PyConfig_Get("parser_debug")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - [`Py_VerboseFlag`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_VerboseFlag): Используйте [`PyConfig.verbose`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.verbose) или [`PyConfig_Get("verbose")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - [`Py_QuietFlag`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_QuietFlag): Используйте [`PyConfig.quiet`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.quiet) или [`PyConfig_Get("quiet")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - [`Py_InteractiveFlag`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_InteractiveFlag): Используйте [`PyConfig.interactive`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.interactive) или [`PyConfig_Get("interactive")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - [`Py_InspectFlag`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_InspectFlag): Используйте [`PyConfig.inspect`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.inspect) или [`PyConfig_Get("inspect")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - [`Py_OptimizeFlag`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_OptimizeFlag): Используйте [`PyConfig.optimization_level`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.optimization_level) или [`PyConfig_Get("optimization_level")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - [`Py_NoSiteFlag`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_NoSiteFlag): Используйте [`PyConfig.site_import`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.site_import) или [`PyConfig_Get("site_import")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - [`Py_BytesWarningFlag`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_BytesWarningFlag): Используйте [`PyConfig.bytes_warning`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.bytes_warning) или [`PyConfig_Get("bytes_warning")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - [`Py_FrozenFlag`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_FrozenFlag): Используйте [`PyConfig.pathconfig_warnings`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.pathconfig_warnings) или [`PyConfig_Get("pathconfig_warnings")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - [`Py_IgnoreEnvironmentFlag`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_IgnoreEnvironmentFlag): Используйте [`PyConfig.use_environment`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.use_environment) или [`PyConfig_Get("use_environment")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - [`Py_DontWriteBytecodeFlag`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_DontWriteBytecodeFlag): Используйте [`PyConfig.write_bytecode`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.write_bytecode) или [`PyConfig_Get("write_bytecode")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - [`Py_NoUserSiteDirectory`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_NoUserSiteDirectory): Используйте [`PyConfig.user_site_directory`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.user_site_directory) или [`PyConfig_Get("user_site_directory")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - [`Py_UnbufferedStdioFlag`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_UnbufferedStdioFlag): Используйте [`PyConfig.buffered_stdio`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.buffered_stdio) или [`PyConfig_Get("buffered_stdio")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - [`Py_HashRandomizationFlag`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_HashRandomizationFlag): Используйте [`PyConfig.use_hash_seed`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.use_hash_seed) и [`PyConfig.hash_seed`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.hash_seed) или [`PyConfig_Get("hash_seed")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - [`Py_IsolatedFlag`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_IsolatedFlag): Используйте [`PyConfig.isolated`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.isolated) или [`PyConfig_Get("isolated")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - [`Py_LegacyWindowsFSEncodingFlag`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_LegacyWindowsFSEncodingFlag): Используйте [`PyPreConfig.legacy_windows_fs_encoding`](https://python-all.ru/3/c-api/init_config.html#c.PyPreConfig.legacy_windows_fs_encoding) или [`PyConfig_Get("legacy_windows_fs_encoding")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - [`Py_LegacyWindowsStdioFlag`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_LegacyWindowsStdioFlag): Используйте [`PyConfig.legacy_windows_stdio`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.legacy_windows_stdio) или [`PyConfig_Get("legacy_windows_stdio")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - `Py_FileSystemDefaultEncoding`, `Py_HasFileSystemDefaultEncoding`: Используйте [`PyConfig.filesystem_encoding`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.filesystem_encoding) или [`PyConfig_Get("filesystem_encoding")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - `Py_FileSystemDefaultEncodeErrors`: Используйте [`PyConfig.filesystem_errors`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig.filesystem_errors) или [`PyConfig_Get("filesystem_errors")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого.
  - `Py_UTF8Mode`: Используйте [`PyPreConfig.utf8_mode`](https://python-all.ru/3/c-api/init_config.html#c.PyPreConfig.utf8_mode) или [`PyConfig_Get("utf8_mode")`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) вместо этого. (см. [`Py_PreInitialize()`](https://python-all.ru/3/c-api/init_config.html#c.Py_PreInitialize))

  API [`Py_InitializeFromConfig()`](https://python-all.ru/3/c-api/interp-lifecycle.html#c.Py_InitializeFromConfig) следует использовать с [`PyConfig`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig) для установки этих параметров. Или [`PyConfig_Get()`](https://python-all.ru/3/c-api/init_config.html#c.PyConfig_Get) можно использовать для получения этих параметров во время выполнения.

### Запланировано удаление в Python 3.18

- Следующие закрытые функции устарели и планируются к удалению в Python 3.18:

  - `_PyBytes_Join()`: используйте [`PyBytes_Join()`](https://python-all.ru/3/c-api/bytes.html#c.PyBytes_Join).
  - `_PyDict_GetItemStringWithError()`: используйте [`PyDict_GetItemStringRef()`](https://python-all.ru/3/c-api/dict.html#c.PyDict_GetItemStringRef).
  - `_PyDict_Pop()`: используйте [`PyDict_Pop()`](https://python-all.ru/3/c-api/dict.html#c.PyDict_Pop).
  - `_PyLong_Sign()`: используйте [`PyLong_GetSign()`](https://python-all.ru/3/c-api/long.html#c.PyLong_GetSign).
  - `_PyLong_FromDigits()` и `_PyLong_New()`: используйте [`PyLongWriter_Create()`](https://python-all.ru/3/c-api/long.html#c.PyLongWriter_Create).
  - `_PyThreadState_UncheckedGet()`: используйте [`PyThreadState_GetUnchecked()`](https://python-all.ru/3/c-api/threads.html#c.PyThreadState_GetUnchecked).
  - `_PyUnicode_AsString()`: используйте [`PyUnicode_AsUTF8()`](https://python-all.ru/3/c-api/unicode.html#c.PyUnicode_AsUTF8).
  - `_PyUnicodeWriter_Init()`: заменить `_PyUnicodeWriter_Init(&writer)` на [`writer = PyUnicodeWriter_Create(0)`](https://python-all.ru/3/c-api/unicode.html#c.PyUnicodeWriter_Create).
  - `_PyUnicodeWriter_Finish()`: заменить `_PyUnicodeWriter_Finish(&writer)` на [`PyUnicodeWriter_Finish(writer)`](https://python-all.ru/3/c-api/unicode.html#c.PyUnicodeWriter_Finish).
  - `_PyUnicodeWriter_Dealloc()`: заменить `_PyUnicodeWriter_Dealloc(&writer)` на [`PyUnicodeWriter_Discard(writer)`](https://python-all.ru/3/c-api/unicode.html#c.PyUnicodeWriter_Discard).
  - `_PyUnicodeWriter_WriteChar()`: заменить `_PyUnicodeWriter_WriteChar(&writer, ch)` на [`PyUnicodeWriter_WriteChar(writer, ch)`](https://python-all.ru/3/c-api/unicode.html#c.PyUnicodeWriter_WriteChar).
  - `_PyUnicodeWriter_WriteStr()`: заменить `_PyUnicodeWriter_WriteStr(&writer, str)` на [`PyUnicodeWriter_WriteStr(writer, str)`](https://python-all.ru/3/c-api/unicode.html#c.PyUnicodeWriter_WriteStr).
  - `_PyUnicodeWriter_WriteSubstring()`: заменить `_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)` на [`PyUnicodeWriter_WriteSubstring(writer, str, start, end)`](https://python-all.ru/3/c-api/unicode.html#c.PyUnicodeWriter_WriteSubstring).
  - `_PyUnicodeWriter_WriteASCIIString()`: заменить `_PyUnicodeWriter_WriteASCIIString(&writer, str)` на [`PyUnicodeWriter_WriteASCII(writer, str)`](https://python-all.ru/3/c-api/unicode.html#c.PyUnicodeWriter_WriteASCII).
  - `_PyUnicodeWriter_WriteLatin1String()`: заменить `_PyUnicodeWriter_WriteLatin1String(&writer, str)` на [`PyUnicodeWriter_WriteUTF8(writer, str)`](https://python-all.ru/3/c-api/unicode.html#c.PyUnicodeWriter_WriteUTF8).
  - `_PyUnicodeWriter_Prepare()`: (нет замены).
  - `_PyUnicodeWriter_PrepareKind()`: (нет замены).
  - `_Py_HashPointer()`: используйте [`Py_HashPointer()`](https://python-all.ru/3/c-api/hash.html#c.Py_HashPointer).
  - `_Py_fopen_obj()`: используйте [`Py_fopen()`](https://python-all.ru/3/c-api/sys.html#c.Py_fopen).

  Проект [pythoncapi-compat](https://python-all.ru/3/deprecations/index.html) можно использовать для получения этих новых открытых функций в Python 3.13 и старше. (Предложено Виктором Стиннером в [gh-128863](https://python-all.ru/3/deprecations/index.html).)

### Будет удалено в будущих версиях

Следующие API устарели и будут удалены, хотя на данный момент дата их удаления не назначена.

- [`Py_TPFLAGS_HAVE_FINALIZE`](https://python-all.ru/3/c-api/typeobj.html#c.Py_TPFLAGS_HAVE_FINALIZE): Не требуется начиная с Python 3.8.
- [`PyErr_Fetch()`](https://python-all.ru/3/c-api/exceptions.html#c.PyErr_Fetch): Вместо этого используйте [`PyErr_GetRaisedException()`](https://python-all.ru/3/c-api/exceptions.html#c.PyErr_GetRaisedException).
- [`PyErr_NormalizeException()`](https://python-all.ru/3/c-api/exceptions.html#c.PyErr_NormalizeException): Вместо этого используйте [`PyErr_GetRaisedException()`](https://python-all.ru/3/c-api/exceptions.html#c.PyErr_GetRaisedException).
- [`PyErr_Restore()`](https://python-all.ru/3/c-api/exceptions.html#c.PyErr_Restore): Вместо этого используйте [`PyErr_SetRaisedException()`](https://python-all.ru/3/c-api/exceptions.html#c.PyErr_SetRaisedException).
- [`PyModule_GetFilename()`](https://python-all.ru/3/c-api/module.html#c.PyModule_GetFilename): Вместо этого используйте [`PyModule_GetFilenameObject()`](https://python-all.ru/3/c-api/module.html#c.PyModule_GetFilenameObject).
- [`PyOS_AfterFork()`](https://python-all.ru/3/c-api/sys.html#c.PyOS_AfterFork): Вместо этого используйте [`PyOS_AfterFork_Child()`](https://python-all.ru/3/c-api/sys.html#c.PyOS_AfterFork_Child).
- [`PySlice_GetIndicesEx()`](https://python-all.ru/3/c-api/slice.html#c.PySlice_GetIndicesEx): Вместо этого используйте [`PySlice_Unpack()`](https://python-all.ru/3/c-api/slice.html#c.PySlice_Unpack) и [`PySlice_AdjustIndices()`](https://python-all.ru/3/c-api/slice.html#c.PySlice_AdjustIndices).
- [`PyUnicode_READY()`](https://python-all.ru/3/c-api/unicode.html#c.PyUnicode_READY): Не требуется начиная с Python 3.12
- `PyErr_Display()`: Вместо этого используйте [`PyErr_DisplayException()`](https://python-all.ru/3/c-api/exceptions.html#c.PyErr_DisplayException).
- `_PyErr_ChainExceptions()`: Вместо этого используйте `_PyErr_ChainExceptions1()`.
- Элемент `PyBytesObject.ob_shash`: вместо этого вызывайте [`PyObject_Hash()`](https://python-all.ru/3/c-api/object.html#c.PyObject_Hash).
- API локального хранилища потока (TLS):

  - [`PyThread_create_key()`](https://python-all.ru/3/c-api/tls.html#c.PyThread_create_key): Вместо этого используйте [`PyThread_tss_alloc()`](https://python-all.ru/3/c-api/tls.html#c.PyThread_tss_alloc).
  - [`PyThread_delete_key()`](https://python-all.ru/3/c-api/tls.html#c.PyThread_delete_key): Вместо этого используйте [`PyThread_tss_free()`](https://python-all.ru/3/c-api/tls.html#c.PyThread_tss_free).
  - [`PyThread_set_key_value()`](https://python-all.ru/3/c-api/tls.html#c.PyThread_set_key_value): Вместо этого используйте [`PyThread_tss_set()`](https://python-all.ru/3/c-api/tls.html#c.PyThread_tss_set).
  - [`PyThread_get_key_value()`](https://python-all.ru/3/c-api/tls.html#c.PyThread_get_key_value): Вместо этого используйте [`PyThread_tss_get()`](https://python-all.ru/3/c-api/tls.html#c.PyThread_tss_get).
  - [`PyThread_delete_key_value()`](https://python-all.ru/3/c-api/tls.html#c.PyThread_delete_key_value): Вместо этого используйте [`PyThread_tss_delete()`](https://python-all.ru/3/c-api/tls.html#c.PyThread_tss_delete).
  - [`PyThread_ReInitTLS()`](https://python-all.ru/3/c-api/tls.html#c.PyThread_ReInitTLS): Не требуется с Python 3.7.
