index.md
1> **Источник:** https://python-all.ru/3.15/deprecations/index.html2>3> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.45---67# Устаревания89## Запланировано к удалению в Python 3.161011- Система импорта:1213 - Установка [`__loader__`](https://python-all.ru/3.15/reference/datamodel.html#module.__loader__) в модуле при отсутствии [`__spec__.loader`](https://python-all.ru/3.15/library/importlib.html#importlib.machinery.ModuleSpec.loader) устарела. В Python 3.16 `__loader__` перестанет устанавливаться или учитываться системой импорта или стандартной библиотекой.14- [`array`](https://python-all.ru/3.15/library/array.html#module-array):1516 - Код формата `'u'` (`wchar_t`) устарел в документации начиная с Python 3.3 и во время выполнения начиная с Python 3.13. Используйте код формата `'w'` ([`Py_UCS4`](https://python-all.ru/3.15/c-api/unicode.html#c.Py_UCS4)) для символов Unicode.17- [`asyncio`](https://python-all.ru/3.15/library/asyncio.html#module-asyncio):1819 - `asyncio.iscoroutinefunction()` устарело и будет удалено в Python 3.16; используйте [`inspect.iscoroutinefunction()`](https://python-all.ru/3.15/library/inspect.html#inspect.iscoroutinefunction) вместо этого. (Предложено Jiahao Li и Kumar Aditya в [gh-122875](https://python-all.ru/3.15/deprecations/index.html).)20 - Система политик [`asyncio`](https://python-all.ru/3.15/library/asyncio.html#module-asyncio) устарела и будет удалена в Python 3.16. В частности, следующие классы и функции устарели:2122 - [`asyncio.AbstractEventLoopPolicy`](https://python-all.ru/3.15/library/asyncio-policy.html#asyncio.AbstractEventLoopPolicy)23 - [`asyncio.DefaultEventLoopPolicy`](https://python-all.ru/3.15/library/asyncio-policy.html#asyncio.DefaultEventLoopPolicy)24 - [`asyncio.WindowsSelectorEventLoopPolicy`](https://python-all.ru/3.15/library/asyncio-policy.html#asyncio.WindowsSelectorEventLoopPolicy)25 - [`asyncio.WindowsProactorEventLoopPolicy`](https://python-all.ru/3.15/library/asyncio-policy.html#asyncio.WindowsProactorEventLoopPolicy)26 - [`asyncio.get_event_loop_policy()`](https://python-all.ru/3.15/library/asyncio-policy.html#asyncio.get_event_loop_policy)27 - [`asyncio.set_event_loop_policy()`](https://python-all.ru/3.15/library/asyncio-policy.html#asyncio.set_event_loop_policy)2829 Для использования нужной реализации цикла событий следует применять [`asyncio.run()`](https://python-all.ru/3.15/library/asyncio-runner.html#asyncio.run) или [`asyncio.Runner`](https://python-all.ru/3.15/library/asyncio-runner.html#asyncio.Runner) с параметром *loop\_factory*.3031 Например, чтобы использовать [`asyncio.SelectorEventLoop`](https://python-all.ru/3.15/library/asyncio-eventloop.html#asyncio.SelectorEventLoop) в Windows:3233 ```python34 import asyncio3536 async def main():37 ...3839 asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)40 ```4142 (Предложено Kumar Aditya в [gh-127949](https://python-all.ru/3.15/deprecations/index.html).)43- [`builtins`](https://python-all.ru/3.15/library/builtins.html#module-builtins):4445 - Поразрядная инверсия для булевых типов, `~True` или `~False` устарела начиная с Python 3.12, поскольку даёт неожиданные и неинтуитивные результаты (`-2` и `-1`). Используйте `not x` для логического отрицания булевого значения. В редких случаях, когда требуется поразрядная инверсия базового целого числа, явно преобразуйте в `int` (`~int(x)`).46- [`functools`](https://python-all.ru/3.15/library/functools.html#module-functools):4748 - Вызов реализации [`functools.reduce()`](https://python-all.ru/3.15/library/functools.html#functools.reduce) на Python с *function* или *sequence* в качестве именованных аргументов устарел начиная с Python 3.14.49- [`logging`](https://python-all.ru/3.15/library/logging.html#module-logging):5051 - Поддержка пользовательских обработчиков логирования с аргументом *strm* устарела и запланирована к удалению в Python 3.16. Вместо этого определяйте обработчики с аргументом *stream*. (Предложено Mariusz Felisiak в [gh-115032](https://python-all.ru/3.15/deprecations/index.html).)52- [`mimetypes`](https://python-all.ru/3.15/library/mimetypes.html#module-mimetypes):5354 - Допустимые расширения начинаются с точки ‘.’ или пусты для [`mimetypes.MimeTypes.add_type()`](https://python-all.ru/3.15/library/mimetypes.html#mimetypes.MimeTypes.add_type). Расширения без точки устарели и будут вызывать [`ValueError`](https://python-all.ru/3.15/library/exceptions.html#ValueError) в Python 3.16. (Предложено Hugo van Kemenade в [gh-75223](https://python-all.ru/3.15/deprecations/index.html).)55- [`shutil`](https://python-all.ru/3.15/library/shutil.html#module-shutil):5657 - Исключение `ExecError` устарело начиная с Python 3.14. Оно не используется ни одной функцией в `shutil` начиная с Python 3.4 и теперь является псевдонимом [`RuntimeError`](https://python-all.ru/3.15/library/exceptions.html#RuntimeError).58- [`symtable`](https://python-all.ru/3.15/library/symtable.html#module-symtable):5960 - Метод [`Class.get_methods`](https://python-all.ru/3.15/library/symtable.html#symtable.Class.get_methods) устарел начиная с Python 3.14.61- [`sys`](https://python-all.ru/3.15/library/sys.html#module-sys):6263 - Функция [`_enablelegacywindowsfsencoding()`](https://python-all.ru/3.15/library/sys.html#sys._enablelegacywindowsfsencoding) устарела начиная с Python 3.13. Используйте переменную окружения [`PYTHONLEGACYWINDOWSFSENCODING`](https://python-all.ru/3.15/using/cmdline.html#envvar-PYTHONLEGACYWINDOWSFSENCODING).64- [`sysconfig`](https://python-all.ru/3.15/library/sysconfig.html#module-sysconfig):6566 - Функция `sysconfig.expand_makefile_vars()` устарела начиная с Python 3.14. Используйте аргумент `vars` из [`sysconfig.get_paths()`](https://python-all.ru/3.15/library/sysconfig.html#sysconfig.get_paths).67- [`tarfile`](https://python-all.ru/3.15/library/tarfile.html#module-tarfile):6869 - Недокументированный и неиспользуемый атрибут `TarFile.tarfile` устарел начиная с Python 3.13.7071## Запланировано к удалению в Python 3.177273- [`datetime`](https://python-all.ru/3.15/library/datetime.html#module-datetime):7475 - [`strptime()`](https://python-all.ru/3.15/library/datetime.html#datetime.datetime.strptime) вызовы со строкой формата, содержащей `%e` (день месяца) без указания года. Это объявлено устаревшим начиная с Python 3.15. (Автор: Stan Ulbrych в [gh-70647](https://python-all.ru/3.15/deprecations/index.html).)76- [`collections.abc`](https://python-all.ru/3.15/library/collections.abc.html#module-collections.abc):7778 - [`collections.abc.ByteString`](https://python-all.ru/3.15/library/collections.abc.html#collections.abc.ByteString) запланирован к удалению в Python 3.17.7980 Используйте `isinstance(obj, collections.abc.Buffer)` для проверки, реализует ли `obj` [протокол буфера](https://python-all.ru/3.15/c-api/buffer.html#bufferobjects) во время выполнения. Для использования в аннотациях типов используйте [`Buffer`](https://python-all.ru/3.15/library/collections.abc.html#collections.abc.Buffer) или объединение, которое явно указывает типы, поддерживаемые вашим кодом (например, `bytes | bytearray | memoryview`).8182 `ByteString` изначально задумывался как абстрактный класс, который должен был служить супертипом как для [`bytes`](https://python-all.ru/3.15/library/stdtypes.html#bytes), так и для [`bytearray`](https://python-all.ru/3.15/library/stdtypes.html#bytearray). Однако, поскольку у ABC никогда не было методов, знание того, что объект является экземпляром `ByteString`, никогда не давало полезной информации об объекте. Другие распространённые типы буферов, такие как [`memoryview`](https://python-all.ru/3.15/library/stdtypes.html#memoryview), также никогда не рассматривались как подтипы `ByteString` (ни во время выполнения, ни статическими проверками типов).8384 См. [**PEP 688**](https://python-all.ru/3.15/deprecations/index.html) для получения подробностей. (Автор: Shantanu Jain в [gh-91896](https://python-all.ru/3.15/deprecations/index.html).)85- [`encodings`](https://python-all.ru/3.15/library/codecs.html#module-encodings):8687 - Передача *кодировок*, не являющихся ASCII, в [`encodings.normalize_encoding()`](https://python-all.ru/3.15/library/codecs.html#encodings.normalize_encoding) объявлена устаревшей и запланирована к удалению в Python 3.17. (Автор: Stan Ulbrych в [gh-136702](https://python-all.ru/3.15/deprecations/index.html).)88- [`webbrowser`](https://python-all.ru/3.15/library/webbrowser.html#module-webbrowser):8990 - `webbrowser.MacOSXOSAScript` объявлен устаревшим в пользу `webbrowser.MacOS`. ([gh-137586](https://python-all.ru/3.15/deprecations/index.html))91- [`typing`](https://python-all.ru/3.15/library/typing.html#module-typing):9293 - До Python 3.14 старые объединения реализовывались с помощью приватного класса `typing._UnionGenericAlias`. Этот класс больше не нужен для реализации, но он сохранён для обратной совместимости, его удаление запланировано на Python 3.17. Пользователям следует использовать документированные вспомогательные средства интроспекции, такие как [`typing.get_origin()`](https://python-all.ru/3.15/library/typing.html#typing.get_origin) и [`typing.get_args()`](https://python-all.ru/3.15/library/typing.html#typing.get_args), вместо того чтобы полагаться на детали приватной реализации.94 - [`typing.ByteString`](https://python-all.ru/3.15/library/typing.html#typing.ByteString), устаревший с Python 3.9, запланирован к удалению в Python 3.17.9596 Используйте `isinstance(obj, collections.abc.Buffer)` для проверки, реализует ли `obj` [протокол буфера](https://python-all.ru/3.15/c-api/buffer.html#bufferobjects) во время выполнения. Для использования в аннотациях типов используйте [`Buffer`](https://python-all.ru/3.15/library/collections.abc.html#collections.abc.Buffer) или объединение, которое явно указывает типы, поддерживаемые вашим кодом (например, `bytes | bytearray | memoryview`).9798 `ByteString` изначально задумывался как абстрактный класс, который должен был служить супертипом как для [`bytes`](https://python-all.ru/3.15/library/stdtypes.html#bytes), так и для [`bytearray`](https://python-all.ru/3.15/library/stdtypes.html#bytearray). Однако, поскольку у ABC никогда не было методов, знание того, что объект является экземпляром `ByteString`, никогда не давало полезной информации об объекте. Другие распространённые типы буферов, такие как [`memoryview`](https://python-all.ru/3.15/library/stdtypes.html#memoryview), также никогда не рассматривались как подтипы `ByteString` (ни во время выполнения, ни статическими проверками типов).99100 См. [**PEP 688**](https://python-all.ru/3.15/deprecations/index.html) для получения подробностей. (Автор: Shantanu Jain в [gh-91896](https://python-all.ru/3.15/deprecations/index.html).)101- [`tkinter`](https://python-all.ru/3.15/library/tkinter.html#module-tkinter):102103 - Методы `tkinter.Variable`: `trace_variable()`, `trace()` (псевдоним `trace_variable()`), `trace_vdelete()` и `trace_vinfo()`, устаревшие с Python 3.14, запланированы к удалению в Python 3.17. Используйте `trace_add()`, `trace_remove()` и `trace_info()` вместо них. (Автор: Serhiy Storchaka в [gh-120220](https://python-all.ru/3.15/deprecations/index.html).)104105## Запланировано удаление в Python 3.18106107- Больше не принимает логическое значение, если ожидается файловый дескриптор. (Автор: Serhiy Storchaka в [gh-82626](https://python-all.ru/3.15/deprecations/index.html).)108- [`decimal`](https://python-all.ru/3.15/library/decimal.html#module-decimal):109110 - Нестандартный и недокументированный [`Decimal`](https://python-all.ru/3.15/library/decimal.html#decimal.Decimal) спецификатор формата `'N'`, который поддерживается только в реализации C модуля `decimal`, устарел с Python 3.13. (Автор: Serhiy Storchaka в [gh-89902](https://python-all.ru/3.15/deprecations/index.html).)111- Устаревшие элементы, определённые [**PEP 829**](https://python-all.ru/3.15/deprecations/index.html):112113 - Строки `import` в файлах `name.pth` молча игнорируются.114115 (Вклад: Barry Warsaw в [gh-148641](https://python-all.ru/3.15/deprecations/index.html).)116117## Запланировано к удалению в Python 3.19118119- [`ctypes`](https://python-all.ru/3.15/library/ctypes.html#module-ctypes):120121 - Неявное переключение на совместимую с MSVC структуру путём установки [`_pack_`](https://python-all.ru/3.15/library/ctypes.html#ctypes.Structure._pack_) без [`_layout_`](https://python-all.ru/3.15/library/ctypes.html#ctypes.Structure._layout_) на платформах, отличных от Windows.122- [`hashlib`](https://python-all.ru/3.15/library/hashlib.html#module-hashlib):123124 - В конструкторах хеш-функций, таких как [`new()`](https://python-all.ru/3.15/library/hashlib.html#hashlib.new), или прямых конструкторах, названных по имени хеша, таких как [`md5()`](https://python-all.ru/3.15/library/hashlib.html#hashlib.md5) и [`sha256()`](https://python-all.ru/3.15/library/hashlib.html#hashlib.sha256), их необязательный параметр начальных данных мог также передаваться как именованный аргумент с именем `data=` или `string=` в различных реализациях `hashlib`.125126 Поддержка имени именованного аргумента `string` теперь устарела и будет удалена в Python 3.19.127128 До Python 3.13 именованный параметр `string` не поддерживался правильно в зависимости от реализации хеш-функций на стороне бэкенда. Предпочтительно передавать начальные данные как позиционный аргумент для максимальной обратной совместимости.129- [`http.cookies`](https://python-all.ru/3.15/library/http.cookies.html#module-http.cookies):130131 - [`http.cookies.Morsel.js_output()`](https://python-all.ru/3.15/library/http.cookies.html#http.cookies.Morsel.js_output) устарело и будет удалено в Python 3.19.132 - [`http.cookies.BaseCookie.js_output()`](https://python-all.ru/3.15/library/http.cookies.html#http.cookies.BaseCookie.js_output) устарело и будет удалено в Python 3.19.133- [`imaplib`](https://python-all.ru/3.15/library/imaplib.html#module-imaplib):134135 - Изменение [`IMAP4.file`](https://python-all.ru/3.15/library/imaplib.html#imaplib.IMAP4.file) теперь устарело и будет удалено в Python 3.19. Это свойство теперь не используется, и изменение его значения не приводит к автоматическому закрытию текущего файла.136137 До Python 3.14 это свойство использовалось для реализации соответствующих методов `read()` и `readline()` для [`IMAP4`](https://python-all.ru/3.15/library/imaplib.html#imaplib.IMAP4), но с тех пор это уже не так.138139## Ожидается удаление в Python 3.20140141- Вызов метода `__new__()` объекта [`struct.Struct`](https://python-all.ru/3.15/library/struct.html#struct.Struct) без аргумента *format* устарел и будет удалён в Python 3.20. Вызов [`__init__()`](https://python-all.ru/3.15/reference/datamodel.html#object.__init__) метода для инициализированных объектов `Struct` устарел и будет удалён в Python 3.20.142143 (Вклад: Sergey B Kirpichev и Serhiy Storchaka в [gh-143715](https://python-all.ru/3.15/deprecations/index.html).)144- Атрибуты `__version__`, `version` и `VERSION` были объявлены устаревшими в этих модулях стандартной библиотеки и будут удалены в Python 3.20. Вместо них используйте [`sys.version_info`](https://python-all.ru/3.15/library/sys.html#sys.version_info).145146 - [`argparse`](https://python-all.ru/3.15/library/argparse.html#module-argparse)147 - [`csv`](https://python-all.ru/3.15/library/csv.html#module-csv)148 - [`ctypes`](https://python-all.ru/3.15/library/ctypes.html#module-ctypes)149 - `ctypes.macholib`150 - [`decimal`](https://python-all.ru/3.15/library/decimal.html#module-decimal) (используйте [`decimal.SPEC_VERSION`](https://python-all.ru/3.15/library/decimal.html#decimal.SPEC_VERSION) вместо)151 - [`http.server`](https://python-all.ru/3.15/library/http.server.html#module-http.server)152 - [`imaplib`](https://python-all.ru/3.15/library/imaplib.html#module-imaplib)153 - [`ipaddress`](https://python-all.ru/3.15/library/ipaddress.html#module-ipaddress)154 - [`json`](https://python-all.ru/3.15/library/json.html#module-json)155 - [`logging`](https://python-all.ru/3.15/library/logging.html#module-logging) (`__date__` также устарел)156 - [`optparse`](https://python-all.ru/3.15/library/optparse.html#module-optparse)157 - [`pickle`](https://python-all.ru/3.15/library/pickle.html#module-pickle)158 - [`platform`](https://python-all.ru/3.15/library/platform.html#module-platform)159 - [`re`](https://python-all.ru/3.15/library/re.html#module-re)160 - [`socketserver`](https://python-all.ru/3.15/library/socketserver.html#module-socketserver)161 - [`tabnanny`](https://python-all.ru/3.15/library/tabnanny.html#module-tabnanny)162 - [`tarfile`](https://python-all.ru/3.15/library/tarfile.html#module-tarfile)163 - [`tkinter.font`](https://python-all.ru/3.15/library/tkinter.font.html#module-tkinter.font)164 - [`tkinter.ttk`](https://python-all.ru/3.15/library/tkinter.ttk.html#module-tkinter.ttk)165 - [`wsgiref.simple_server`](https://python-all.ru/3.15/library/wsgiref.html#module-wsgiref.simple_server)166 - [`xml.etree.ElementTree`](https://python-all.ru/3.15/library/xml.etree.elementtree.html#module-xml.etree.ElementTree)167 - `xml.sax.expatreader`168 - [`xml.sax.handler`](https://python-all.ru/3.15/library/xml.sax.handler.html#module-xml.sax.handler)169 - [`zlib`](https://python-all.ru/3.15/library/zlib.html#module-zlib)170171 (Вклад: Hugo van Kemenade и Stan Ulbrych в [gh-76007](https://python-all.ru/3.15/deprecations/index.html).)172- Устаревшие элементы, определённые [**PEP 829**](https://python-all.ru/3.15/deprecations/index.html):173174 - Предупреждения выводятся для строк `import`, найденных в `name.pth` файлах.175 - Файлы `name.pth` больше не декодируются в кодировке локали по умолчанию. Они **ДОЛЖНЫ** быть закодированы в `utf-8-sig`.176177 (Вклад: Barry Warsaw в [gh-148641](https://python-all.ru/3.15/deprecations/index.html).)178- [`ast`](https://python-all.ru/3.15/library/ast.html#module-ast):179180 - Создание экземпляров абстрактных узлов AST (таких как [`ast.AST`](https://python-all.ru/3.15/library/ast.html#ast.AST) или `ast.expr`) устарело и будет вызывать ошибку в Python 3.20.181182## Будет удалено в будущих версиях183184Следующие API будут удалены в будущем, хотя на данный момент нет запланированной даты их удаления.185186- [`argparse`](https://python-all.ru/3.15/library/argparse.html#module-argparse):187188 - Вложение групп аргументов и вложение взаимоисключающих групп устарело.189 - Передача недокументированного именованного аргумента *prefix\_chars* в [`add_argument_group()`](https://python-all.ru/3.15/library/argparse.html#argparse.ArgumentParser.add_argument_group) теперь устарела.190 - Конвертер типов [`argparse.FileType`](https://python-all.ru/3.15/library/argparse.html#argparse.FileType) устарел.191- [`builtins`](https://python-all.ru/3.15/library/builtins.html#module-builtins):192193 - Генераторы: сигнатура `throw(type, exc, tb)` и `athrow(type, exc, tb)` устарела: используйте `throw(exc)` и `athrow(exc)` вместо неё, сигнатуру с одним аргументом.194 - В настоящее время 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.15/reference/expressions.html#and), [`else`](https://python-all.ru/3.15/reference/compound_stmts.html#else), [`for`](https://python-all.ru/3.15/reference/compound_stmts.html#for), [`if`](https://python-all.ru/3.15/reference/compound_stmts.html#if), [`in`](https://python-all.ru/3.15/reference/expressions.html#in), [`is`](https://python-all.ru/3.15/reference/expressions.html#is) и [`or`](https://python-all.ru/3.15/reference/expressions.html#or). В будущем выпуске это будет изменено на синтаксическую ошибку. ([gh-87999](https://python-all.ru/3.15/deprecations/index.html))195 - Поддержка методов `__index__()` и `__int__()`, возвращающих не-int тип: эти методы должны будут возвращать экземпляр строгого подкласса [`int`](https://python-all.ru/3.15/library/functions.html#int).196 - Поддержка метода `__float__()`, возвращающего строгий подкласс [`float`](https://python-all.ru/3.15/library/functions.html#float): эти методы должны будут возвращать экземпляр `float`.197 - Поддержка метода `__complex__()`, возвращающего строгий подкласс [`complex`](https://python-all.ru/3.15/library/functions.html#complex): эти методы должны будут возвращать экземпляр `complex`.198 - Передача комплексного числа в качестве аргумента *real* или *imag* в конструкторе [`complex()`](https://python-all.ru/3.15/library/functions.html#complex) теперь устарела; его следует передавать только как единственный позиционный аргумент. (Автор: Сергей Сторчака в [gh-109218](https://python-all.ru/3.15/deprecations/index.html).)199- [`calendar`](https://python-all.ru/3.15/library/calendar.html#module-calendar): константы `calendar.January` и `calendar.February` устарели и заменены на [`calendar.JANUARY`](https://python-all.ru/3.15/library/calendar.html#calendar.JANUARY) и [`calendar.FEBRUARY`](https://python-all.ru/3.15/library/calendar.html#calendar.FEBRUARY). (Автор: Prince Roshan в [gh-103636](https://python-all.ru/3.15/deprecations/index.html).)200- [`codecs`](https://python-all.ru/3.15/library/codecs.html#module-codecs): используйте [`open()`](https://python-all.ru/3.15/library/functions.html#open) вместо [`codecs.open()`](https://python-all.ru/3.15/library/codecs.html#codecs.open). ([gh-133038](https://python-all.ru/3.15/deprecations/index.html))201- `codeobject.co_lnotab`: используйте метод [`codeobject.co_lines()`](https://python-all.ru/3.15/reference/datamodel.html#codeobject.co_lines) вместо этого.202- [`datetime`](https://python-all.ru/3.15/library/datetime.html#module-datetime):203204 - [`utcnow()`](https://python-all.ru/3.15/library/datetime.html#datetime.datetime.utcnow): используйте `datetime.datetime.now(tz=datetime.UTC)`.205 - [`utcfromtimestamp()`](https://python-all.ru/3.15/library/datetime.html#datetime.datetime.utcfromtimestamp): используйте `datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)`.206- [`gettext`](https://python-all.ru/3.15/library/gettext.html#module-gettext): значение множественного числа должно быть целым числом.207- [`importlib`](https://python-all.ru/3.15/library/importlib.html#module-importlib):208209 - [`cache_from_source()`](https://python-all.ru/3.15/library/importlib.html#importlib.util.cache_from_source): параметр *debug\_override* устарел: используйте параметр *optimization* вместо него.210- [`importlib.metadata`](https://python-all.ru/3.15/library/importlib.metadata.html#module-importlib.metadata):211212 - `EntryPoints`: интерфейс кортежа.213 - Неявное `None` для возвращаемых значений.214- [`logging`](https://python-all.ru/3.15/library/logging.html#module-logging): метод `warn()` устарел начиная с Python 3.3, используйте [`warning()`](https://python-all.ru/3.15/library/logging.html#logging.warning) вместо него.215- [`mailbox`](https://python-all.ru/3.15/library/mailbox.html#module-mailbox): использование StringIO в режиме ввода и текстовом режиме устарело, используйте BytesIO и двоичный режим.216- [`os`](https://python-all.ru/3.15/library/os.html#module-os): вызов [`os.register_at_fork()`](https://python-all.ru/3.15/library/os.html#os.register_at_fork) в многопоточном процессе.217- [`os.path`](https://python-all.ru/3.15/library/os.path.html#module-os.path): [`os.path.commonprefix()`](https://python-all.ru/3.15/library/os.path.html#os.path.commonprefix) устарела, используйте [`os.path.commonpath()`](https://python-all.ru/3.15/library/os.path.html#os.path.commonpath) для префиксов путей. Функция `os.path.commonprefix()` объявлена устаревшей из-за вводящего в заблуждение названия и модуля. Эта функция небезопасна для использования в качестве префиксов путей, несмотря на то что находится в модуле для работы с путями, что означает, что легко случайно внести уязвимости обхода путей в программы на Python, используя эту функцию.218- `pydoc.ErrorDuringImport`: кортежное значение для параметра *exc\_info* устарело, используйте экземпляр исключения.219- [`re`](https://python-all.ru/3.15/library/re.html#module-re): теперь применяются более строгие правила для числовых ссылок на группы и имён групп в регулярных выражениях. В качестве числовой ссылки теперь принимается только последовательность цифр ASCII. Имя группы в байтовых шаблонах и строках замены теперь может содержать только буквы ASCII, цифры и знак подчёркивания. (Автор: Сергей Сторчака в [gh-91760](https://python-all.ru/3.15/deprecations/index.html).)220- [`shutil`](https://python-all.ru/3.15/library/shutil.html#module-shutil): параметр *onerror* метода [`rmtree()`](https://python-all.ru/3.15/library/shutil.html#shutil.rmtree) устарел в Python 3.12; используйте параметр *onexc* вместо него.221- [`ssl`](https://python-all.ru/3.15/library/ssl.html#module-ssl): опции и протоколы:222223 - [`ssl.SSLContext`](https://python-all.ru/3.15/library/ssl.html#ssl.SSLContext) без аргумента протокол устарело.224 - [`ssl.SSLContext`](https://python-all.ru/3.15/library/ssl.html#ssl.SSLContext): [`set_npn_protocols()`](https://python-all.ru/3.15/library/ssl.html#ssl.SSLContext.set_npn_protocols) и `selected_npn_protocol()` устарели: используйте ALPN вместо них.225 - `ssl.OP_NO_SSL*`: опции226 - `ssl.OP_NO_TLS*`: опции227 - `ssl.PROTOCOL_SSLv3`228 - `ssl.PROTOCOL_TLS`229 - `ssl.PROTOCOL_TLSv1`230 - `ssl.PROTOCOL_TLSv1_1`231 - `ssl.PROTOCOL_TLSv1_2`232 - `ssl.TLSVersion.SSLv3`233 - `ssl.TLSVersion.TLSv1`234 - `ssl.TLSVersion.TLSv1_1`235- [`threading`](https://python-all.ru/3.15/library/threading.html#module-threading): методы236237 - `threading.Condition.notifyAll()`: используйте [`notify_all()`](https://python-all.ru/3.15/library/threading.html#threading.Condition.notify_all).238 - `threading.Event.isSet()`: используйте [`is_set()`](https://python-all.ru/3.15/library/threading.html#threading.Event.is_set).239 - `threading.Thread.isDaemon()`, [`threading.Thread.setDaemon()`](https://python-all.ru/3.15/library/threading.html#threading.Thread.setDaemon): используйте атрибут [`threading.Thread.daemon`](https://python-all.ru/3.15/library/threading.html#threading.Thread.daemon).240 - `threading.Thread.getName()`, [`threading.Thread.setName()`](https://python-all.ru/3.15/library/threading.html#threading.Thread.setName): используйте атрибут [`threading.Thread.name`](https://python-all.ru/3.15/library/threading.html#threading.Thread.name).241 - `threading.currentThread()`: используйте [`threading.current_thread()`](https://python-all.ru/3.15/library/threading.html#threading.current_thread).242 - `threading.activeCount()`: используйте [`threading.active_count()`](https://python-all.ru/3.15/library/threading.html#threading.active_count).243- [`typing.Text`](https://python-all.ru/3.15/library/typing.html#typing.Text) ([gh-92332](https://python-all.ru/3.15/deprecations/index.html)).244- Внутренний класс `typing._UnionGenericAlias` больше не используется для реализации [`typing.Union`](https://python-all.ru/3.15/library/typing.html#typing.Union). Для сохранения совместимости с пользователями, использующими этот закрытый класс, будет предоставлена прослойка совместимости как минимум до Python 3.17. (Автор: Jelle Zijlstra, [gh-105499](https://python-all.ru/3.15/deprecations/index.html).)245- [`unittest.IsolatedAsyncioTestCase`](https://python-all.ru/3.15/library/unittest.html#unittest.IsolatedAsyncioTestCase): возврат значения, не являющегося `None`, из тестового примера устарел.246- [`urllib.parse`](https://python-all.ru/3.15/library/urllib.parse.html#module-urllib.parse) устаревшие функции: используйте [`urlparse()`](https://python-all.ru/3.15/library/urllib.parse.html#urllib.parse.urlparse) вместо них.247248 - `splitattr()`249 - `splithost()`250 - `splitnport()`251 - `splitpasswd()`252 - `splitport()`253 - `splitquery()`254 - `splittag()`255 - `splittype()`256 - `splituser()`257 - `splitvalue()`258 - `to_bytes()`259- [`wsgiref`](https://python-all.ru/3.15/library/wsgiref.html#module-wsgiref): `SimpleHandler.stdout.write()` не должна выполнять частичную запись.260- [`xml.etree.ElementTree`](https://python-all.ru/3.15/library/xml.etree.elementtree.html#module-xml.etree.ElementTree): проверка истинностного значения [`Element`](https://python-all.ru/3.15/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element) устарела. В будущем выпуске она всегда будет возвращать `True`. Вместо этого используйте явные проверки `len(elem)` или `elem is not None`.261- [`sys._clear_type_cache()`](https://python-all.ru/3.15/library/sys.html#sys._clear_type_cache) устарело: используйте [`sys._clear_internal_caches()`](https://python-all.ru/3.15/library/sys.html#sys._clear_internal_caches) вместо него.262263## Мягкие устаревания264265Планов по удалению [мягко устаревших](https://python-all.ru/3.15/glossary.html#term-soft-deprecated) API нет.266267- [`re.match()`](https://python-all.ru/3.15/library/re.html#re.match) и [`re.Pattern.match()`](https://python-all.ru/3.15/library/re.html#re.Pattern.match) теперь [мягко устарели](https://python-all.ru/3.15/glossary.html#term-soft-deprecated) в пользу новых API [`re.prefixmatch()`](https://python-all.ru/3.15/library/re.html#re.prefixmatch) и [`re.Pattern.prefixmatch()`](https://python-all.ru/3.15/library/re.html#re.Pattern.prefixmatch), которые были добавлены как альтернативные, более явные имена. Они предназначены для устранения путаницы относительно того, что означает *match*, следуя мантре Дзена Python *«Явное лучше неявного»*. Большинство других библиотек регулярных выражений используют API с именем *match* для обозначения того, что в Python всегда называлось *search*.268269 Мы **не** планируем удалять старое имя `match()`, так как оно используется в коде более 30 лет. Код, поддерживающий старые версии Python, должен продолжать использовать `match()`, а в новом коде следует предпочитать `prefixmatch()`. См. [prefixmatch() vs. match()](https://python-all.ru/3.15/library/re.html#prefixmatch-vs-match).270271 (Авторы: Gregory P. Smith, [gh-86519](https://python-all.ru/3.15/deprecations/index.html), и Hugo van Kemenade, [gh-148100](https://python-all.ru/3.15/deprecations/index.html).)272- Использование `'F'` и `'D'` кодов типа форматирования модуля [`struct`](https://python-all.ru/3.15/library/struct.html#module-struct) теперь [мягко устарело](https://python-all.ru/3.15/glossary.html#term-soft-deprecated) в пользу двухбуквенных форм `'Zf'` и `'Zd'`. (Вклад: Sergey B Kirpichev в [gh-121249](https://python-all.ru/3.15/deprecations/index.html).)273274## Устаревания в C API275276### Ожидается удаление в Python 3.15277278- `PyImport_ImportModuleNoBlock()`: Вместо этого используйте [`PyImport_ImportModule()`](https://python-all.ru/3.15/c-api/import.html#c.PyImport_ImportModule).279- `PyWeakref_GetObject()` и `PyWeakref_GET_OBJECT()`: Вместо этого используйте [`PyWeakref_GetRef()`](https://python-all.ru/3.15/c-api/weakref.html#c.PyWeakref_GetRef). Проект [pythoncapi-compat](https://python-all.ru/3.15/deprecations/index.html) можно использовать, чтобы получить `PyWeakref_GetRef()` на Python 3.12 и старше.280- `PyUnicode_AsDecodedObject()`: Вместо этого используйте [`PyCodec_Decode()`](https://python-all.ru/3.15/c-api/codec.html#c.PyCodec_Decode).281- `PyUnicode_AsDecodedUnicode()`: Вместо этого используйте [`PyCodec_Decode()`](https://python-all.ru/3.15/c-api/codec.html#c.PyCodec_Decode); Обратите внимание, что некоторые кодеки (например, «base64») могут возвращать тип, отличный от [`str`](https://python-all.ru/3.15/library/stdtypes.html#str), например, [`bytes`](https://python-all.ru/3.15/library/stdtypes.html#bytes).282- `PyUnicode_AsEncodedObject()`: Вместо этого используйте [`PyCodec_Encode()`](https://python-all.ru/3.15/c-api/codec.html#c.PyCodec_Encode).283- `PyUnicode_AsEncodedUnicode()`: Вместо этого используйте [`PyCodec_Encode()`](https://python-all.ru/3.15/c-api/codec.html#c.PyCodec_Encode); Обратите внимание, что некоторые кодеки (например, «base64») могут возвращать тип, отличный от [`bytes`](https://python-all.ru/3.15/library/stdtypes.html#bytes), например, [`str`](https://python-all.ru/3.15/library/stdtypes.html#str).284- Функции инициализации Python, устаревшие в Python 3.13:285286 - `Py_GetPath()`: Вместо этого используйте [`PyConfig_Get("module_search_paths")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) ([`sys.path`](https://python-all.ru/3.15/library/sys.html#sys.path)).287 - `Py_GetPrefix()`: Вместо этого используйте [`PyConfig_Get("base_prefix")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) ([`sys.base_prefix`](https://python-all.ru/3.15/library/sys.html#sys.base_prefix)). Используйте `PyConfig_Get("prefix")` ([`sys.prefix`](https://python-all.ru/3.15/library/sys.html#sys.prefix)), если необходимо обрабатывать [виртуальные окружения](https://python-all.ru/3.15/library/venv.html#venv-def).288 - `Py_GetExecPrefix()`: Вместо этого используйте [`PyConfig_Get("base_exec_prefix")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) ([`sys.base_exec_prefix`](https://python-all.ru/3.15/library/sys.html#sys.base_exec_prefix)). Используйте `PyConfig_Get("exec_prefix")` ([`sys.exec_prefix`](https://python-all.ru/3.15/library/sys.html#sys.exec_prefix)), если необходимо обрабатывать [виртуальные окружения](https://python-all.ru/3.15/library/venv.html#venv-def).289 - `Py_GetProgramFullPath()`: Вместо этого используйте [`PyConfig_Get("executable")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) ([`sys.executable`](https://python-all.ru/3.15/library/sys.html#sys.executable)).290 - `Py_GetProgramName()`: Вместо этого используйте [`PyConfig_Get("executable")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) ([`sys.executable`](https://python-all.ru/3.15/library/sys.html#sys.executable)).291 - `Py_GetPythonHome()`: Используйте [`PyConfig_Get("home")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) или переменную окружения [`PYTHONHOME`](https://python-all.ru/3.15/using/cmdline.html#envvar-PYTHONHOME).292293 Проект [pythoncapi-compat](https://python-all.ru/3.15/deprecations/index.html) можно использовать, чтобы получить [`PyConfig_Get()`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) на Python 3.13 и старше.294- Функции для настройки инициализации Python, устаревшие в Python 3.11:295296 - `PySys_SetArgvEx()`: Вместо этого задайте [`PyConfig.argv`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.argv).297 - `PySys_SetArgv()`: Вместо этого задайте [`PyConfig.argv`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.argv).298 - `Py_SetProgramName()`: Вместо этого задайте [`PyConfig.program_name`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.program_name).299 - `Py_SetPythonHome()`: Вместо этого задайте [`PyConfig.home`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.home).300 - `PySys_ResetWarnOptions()`: Вместо этого очистите [`sys.warnoptions`](https://python-all.ru/3.15/library/sys.html#sys.warnoptions) и `warnings.filters`.301302 API [`Py_InitializeFromConfig()`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_InitializeFromConfig) следует использовать с [`PyConfig`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig) вместо этого.303- Глобальные переменные конфигурации:304305 - [`Py_DebugFlag`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_DebugFlag): Используйте [`PyConfig.parser_debug`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.parser_debug) или [`PyConfig_Get("parser_debug")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.306 - [`Py_VerboseFlag`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_VerboseFlag): Используйте [`PyConfig.verbose`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.verbose) или [`PyConfig_Get("verbose")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.307 - [`Py_QuietFlag`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_QuietFlag): Используйте [`PyConfig.quiet`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.quiet) или [`PyConfig_Get("quiet")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.308 - [`Py_InteractiveFlag`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_InteractiveFlag): Используйте [`PyConfig.interactive`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.interactive) или [`PyConfig_Get("interactive")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.309 - [`Py_InspectFlag`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_InspectFlag): Используйте [`PyConfig.inspect`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.inspect) или [`PyConfig_Get("inspect")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.310 - [`Py_OptimizeFlag`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_OptimizeFlag): Используйте [`PyConfig.optimization_level`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.optimization_level) или [`PyConfig_Get("optimization_level")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.311 - [`Py_NoSiteFlag`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_NoSiteFlag): Используйте [`PyConfig.site_import`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.site_import) или [`PyConfig_Get("site_import")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.312 - [`Py_BytesWarningFlag`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_BytesWarningFlag): Используйте [`PyConfig.bytes_warning`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.bytes_warning) или [`PyConfig_Get("bytes_warning")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.313 - [`Py_FrozenFlag`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_FrozenFlag): Используйте [`PyConfig.pathconfig_warnings`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.pathconfig_warnings) или [`PyConfig_Get("pathconfig_warnings")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.314 - [`Py_IgnoreEnvironmentFlag`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_IgnoreEnvironmentFlag): Используйте [`PyConfig.use_environment`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.use_environment) или [`PyConfig_Get("use_environment")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.315 - [`Py_DontWriteBytecodeFlag`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_DontWriteBytecodeFlag): Используйте [`PyConfig.write_bytecode`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.write_bytecode) или [`PyConfig_Get("write_bytecode")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.316 - [`Py_NoUserSiteDirectory`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_NoUserSiteDirectory): Используйте [`PyConfig.user_site_directory`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.user_site_directory) или [`PyConfig_Get("user_site_directory")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.317 - [`Py_UnbufferedStdioFlag`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_UnbufferedStdioFlag): Используйте [`PyConfig.buffered_stdio`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.buffered_stdio) или [`PyConfig_Get("buffered_stdio")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.318 - [`Py_HashRandomizationFlag`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_HashRandomizationFlag): Используйте [`PyConfig.use_hash_seed`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.use_hash_seed) и [`PyConfig.hash_seed`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.hash_seed) или [`PyConfig_Get("hash_seed")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.319 - [`Py_IsolatedFlag`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_IsolatedFlag): Используйте [`PyConfig.isolated`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.isolated) или [`PyConfig_Get("isolated")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.320 - [`Py_LegacyWindowsFSEncodingFlag`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_LegacyWindowsFSEncodingFlag): Используйте [`PyPreConfig.legacy_windows_fs_encoding`](https://python-all.ru/3.15/c-api/init_config.html#c.PyPreConfig.legacy_windows_fs_encoding) или [`PyConfig_Get("legacy_windows_fs_encoding")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.321 - [`Py_LegacyWindowsStdioFlag`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_LegacyWindowsStdioFlag): Используйте [`PyConfig.legacy_windows_stdio`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.legacy_windows_stdio) или [`PyConfig_Get("legacy_windows_stdio")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.322 - `Py_FileSystemDefaultEncoding`, `Py_HasFileSystemDefaultEncoding`: Используйте [`PyConfig.filesystem_encoding`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.filesystem_encoding) или [`PyConfig_Get("filesystem_encoding")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.323 - `Py_FileSystemDefaultEncodeErrors`: Используйте [`PyConfig.filesystem_errors`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig.filesystem_errors) или [`PyConfig_Get("filesystem_errors")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого.324 - `Py_UTF8Mode`: Используйте [`PyPreConfig.utf8_mode`](https://python-all.ru/3.15/c-api/init_config.html#c.PyPreConfig.utf8_mode) или [`PyConfig_Get("utf8_mode")`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) вместо этого. (см. [`Py_PreInitialize()`](https://python-all.ru/3.15/c-api/init_config.html#c.Py_PreInitialize))325326 API [`Py_InitializeFromConfig()`](https://python-all.ru/3.15/c-api/interp-lifecycle.html#c.Py_InitializeFromConfig) следует использовать с [`PyConfig`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig) для установки этих параметров. Или [`PyConfig_Get()`](https://python-all.ru/3.15/c-api/init_config.html#c.PyConfig_Get) можно использовать для получения этих параметров во время выполнения.327328### Запланировано к удалению в Python 3.16329330- Встроенная копия `libmpdec`.331332### Запланировано удаление в Python 3.18333334- Следующие закрытые функции устарели и планируются к удалению в Python 3.18:335336 - `_PyBytes_Join()`: используйте [`PyBytes_Join()`](https://python-all.ru/3.15/c-api/bytes.html#c.PyBytes_Join).337 - `_PyDict_GetItemStringWithError()`: используйте [`PyDict_GetItemStringRef()`](https://python-all.ru/3.15/c-api/dict.html#c.PyDict_GetItemStringRef).338 - `_PyDict_Pop()`: используйте [`PyDict_Pop()`](https://python-all.ru/3.15/c-api/dict.html#c.PyDict_Pop).339 - `_PyLong_Sign()`: используйте [`PyLong_GetSign()`](https://python-all.ru/3.15/c-api/long.html#c.PyLong_GetSign).340 - `_PyLong_FromDigits()` и `_PyLong_New()`: используйте [`PyLongWriter_Create()`](https://python-all.ru/3.15/c-api/long.html#c.PyLongWriter_Create).341 - `_PyThreadState_UncheckedGet()`: используйте [`PyThreadState_GetUnchecked()`](https://python-all.ru/3.15/c-api/threads.html#c.PyThreadState_GetUnchecked).342 - `_PyUnicode_AsString()`: используйте [`PyUnicode_AsUTF8()`](https://python-all.ru/3.15/c-api/unicode.html#c.PyUnicode_AsUTF8).343 - `_PyUnicodeWriter_Init()`: заменить `_PyUnicodeWriter_Init(&writer)` на [`writer = PyUnicodeWriter_Create(0)`](https://python-all.ru/3.15/c-api/unicode.html#c.PyUnicodeWriter_Create).344 - `_PyUnicodeWriter_Finish()`: заменить `_PyUnicodeWriter_Finish(&writer)` на [`PyUnicodeWriter_Finish(writer)`](https://python-all.ru/3.15/c-api/unicode.html#c.PyUnicodeWriter_Finish).345 - `_PyUnicodeWriter_Dealloc()`: заменить `_PyUnicodeWriter_Dealloc(&writer)` на [`PyUnicodeWriter_Discard(writer)`](https://python-all.ru/3.15/c-api/unicode.html#c.PyUnicodeWriter_Discard).346 - `_PyUnicodeWriter_WriteChar()`: заменить `_PyUnicodeWriter_WriteChar(&writer, ch)` на [`PyUnicodeWriter_WriteChar(writer, ch)`](https://python-all.ru/3.15/c-api/unicode.html#c.PyUnicodeWriter_WriteChar).347 - `_PyUnicodeWriter_WriteStr()`: заменить `_PyUnicodeWriter_WriteStr(&writer, str)` на [`PyUnicodeWriter_WriteStr(writer, str)`](https://python-all.ru/3.15/c-api/unicode.html#c.PyUnicodeWriter_WriteStr).348 - `_PyUnicodeWriter_WriteSubstring()`: заменить `_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)` на [`PyUnicodeWriter_WriteSubstring(writer, str, start, end)`](https://python-all.ru/3.15/c-api/unicode.html#c.PyUnicodeWriter_WriteSubstring).349 - `_PyUnicodeWriter_WriteASCIIString()`: заменить `_PyUnicodeWriter_WriteASCIIString(&writer, str)` на [`PyUnicodeWriter_WriteASCII(writer, str)`](https://python-all.ru/3.15/c-api/unicode.html#c.PyUnicodeWriter_WriteASCII).350 - `_PyUnicodeWriter_WriteLatin1String()`: заменить `_PyUnicodeWriter_WriteLatin1String(&writer, str)` на [`PyUnicodeWriter_WriteUTF8(writer, str)`](https://python-all.ru/3.15/c-api/unicode.html#c.PyUnicodeWriter_WriteUTF8).351 - `_PyUnicodeWriter_Prepare()`: (нет замены).352 - `_PyUnicodeWriter_PrepareKind()`: (нет замены).353 - `_Py_HashPointer()`: используйте [`Py_HashPointer()`](https://python-all.ru/3.15/c-api/hash.html#c.Py_HashPointer).354 - `_Py_fopen_obj()`: используйте [`Py_fopen()`](https://python-all.ru/3.15/c-api/sys.html#c.Py_fopen).355356 Проект [pythoncapi-compat](https://python-all.ru/3.15/deprecations/index.html) можно использовать для получения этих новых открытых функций в Python 3.13 и старше. (Предложено Виктором Стиннером в [gh-128863](https://python-all.ru/3.15/deprecations/index.html).)357358### Запланировано к удалению в Python 3.19359360- [**PEP 456**](https://python-all.ru/3.15/deprecations/index.html) поддержка встраивающих систем для определения схемы хеширования строк.361362### Ожидается удаление в Python 3.20363364- `_PyObject_CallMethodId()`, `_PyObject_GetAttrId()` и `_PyUnicode_FromId()` устарели с версии 3.15 и будут удалены в 3.20. Вместо этого используйте [`PyUnicode_InternFromString()`](https://python-all.ru/3.15/c-api/unicode.html#c.PyUnicode_InternFromString) и кешируйте результат в состоянии модуля, затем вызывайте [`PyObject_CallMethod()`](https://python-all.ru/3.15/c-api/call.html#c.PyObject_CallMethod) или [`PyObject_GetAttr()`](https://python-all.ru/3.15/c-api/object.html#c.PyObject_GetAttr). (Предложено Виктором Стиннером в [gh-141049](https://python-all.ru/3.15/deprecations/index.html).)365- Поле `cval` в [`PyComplexObject`](https://python-all.ru/3.15/c-api/complex.html#c.PyComplexObject) ([gh-128813](https://python-all.ru/3.15/deprecations/index.html)). Используйте [`PyComplex_AsCComplex()`](https://python-all.ru/3.15/c-api/complex.html#c.PyComplex_AsCComplex) и [`PyComplex_FromCComplex()`](https://python-all.ru/3.15/c-api/complex.html#c.PyComplex_FromCComplex) для преобразования комплексного числа Python в/из представления C [`Py_complex`](https://python-all.ru/3.15/c-api/complex.html#c.Py_complex) .366- Макросы `Py_MATH_PIl` и `Py_MATH_El`.367368### Будет удалено в будущих версиях369370Следующие API устарели и будут удалены, хотя на данный момент дата их удаления не назначена.371372- [`Py_TPFLAGS_HAVE_FINALIZE`](https://python-all.ru/3.15/c-api/typeobj.html#c.Py_TPFLAGS_HAVE_FINALIZE): Не требуется начиная с Python 3.8.373- [`PyErr_Fetch()`](https://python-all.ru/3.15/c-api/exceptions.html#c.PyErr_Fetch): Вместо этого используйте [`PyErr_GetRaisedException()`](https://python-all.ru/3.15/c-api/exceptions.html#c.PyErr_GetRaisedException).374- [`PyErr_NormalizeException()`](https://python-all.ru/3.15/c-api/exceptions.html#c.PyErr_NormalizeException): Вместо этого используйте [`PyErr_GetRaisedException()`](https://python-all.ru/3.15/c-api/exceptions.html#c.PyErr_GetRaisedException).375- [`PyErr_Restore()`](https://python-all.ru/3.15/c-api/exceptions.html#c.PyErr_Restore): Вместо этого используйте [`PyErr_SetRaisedException()`](https://python-all.ru/3.15/c-api/exceptions.html#c.PyErr_SetRaisedException).376- [`PyModule_GetFilename()`](https://python-all.ru/3.15/c-api/module.html#c.PyModule_GetFilename): Вместо этого используйте [`PyModule_GetFilenameObject()`](https://python-all.ru/3.15/c-api/module.html#c.PyModule_GetFilenameObject).377- [`PyOS_AfterFork()`](https://python-all.ru/3.15/c-api/sys.html#c.PyOS_AfterFork): Вместо этого используйте [`PyOS_AfterFork_Child()`](https://python-all.ru/3.15/c-api/sys.html#c.PyOS_AfterFork_Child).378- [`PySlice_GetIndicesEx()`](https://python-all.ru/3.15/c-api/slice.html#c.PySlice_GetIndicesEx): Вместо этого используйте [`PySlice_Unpack()`](https://python-all.ru/3.15/c-api/slice.html#c.PySlice_Unpack) и [`PySlice_AdjustIndices()`](https://python-all.ru/3.15/c-api/slice.html#c.PySlice_AdjustIndices).379- [`PyUnicode_READY()`](https://python-all.ru/3.15/c-api/unicode.html#c.PyUnicode_READY): Не требуется начиная с Python 3.12380- `PyErr_Display()`: Вместо этого используйте [`PyErr_DisplayException()`](https://python-all.ru/3.15/c-api/exceptions.html#c.PyErr_DisplayException).381- `_PyErr_ChainExceptions()`: Вместо этого используйте `_PyErr_ChainExceptions1()`.382- Элемент `PyBytesObject.ob_shash`: вместо этого вызывайте [`PyObject_Hash()`](https://python-all.ru/3.15/c-api/object.html#c.PyObject_Hash).383- API локального хранилища потока (TLS):384385 - [`PyThread_create_key()`](https://python-all.ru/3.15/c-api/tls.html#c.PyThread_create_key): Вместо этого используйте [`PyThread_tss_alloc()`](https://python-all.ru/3.15/c-api/tls.html#c.PyThread_tss_alloc).386 - [`PyThread_delete_key()`](https://python-all.ru/3.15/c-api/tls.html#c.PyThread_delete_key): Вместо этого используйте [`PyThread_tss_free()`](https://python-all.ru/3.15/c-api/tls.html#c.PyThread_tss_free).387 - [`PyThread_set_key_value()`](https://python-all.ru/3.15/c-api/tls.html#c.PyThread_set_key_value): Вместо этого используйте [`PyThread_tss_set()`](https://python-all.ru/3.15/c-api/tls.html#c.PyThread_tss_set).388 - [`PyThread_get_key_value()`](https://python-all.ru/3.15/c-api/tls.html#c.PyThread_get_key_value): Вместо этого используйте [`PyThread_tss_get()`](https://python-all.ru/3.15/c-api/tls.html#c.PyThread_tss_get).389 - [`PyThread_delete_key_value()`](https://python-all.ru/3.15/c-api/tls.html#c.PyThread_delete_key_value): Вместо этого используйте [`PyThread_tss_delete()`](https://python-all.ru/3.15/c-api/tls.html#c.PyThread_tss_delete).390 - [`PyThread_ReInitTLS()`](https://python-all.ru/3.15/c-api/tls.html#c.PyThread_ReInitTLS): Не требуется с Python 3.7.391