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

index.md

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

1> **Источник:** https://python-all.ru/3.14/c-api/index.html2>3> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.45---67# Справочное руководство по Python/C API89В данном руководстве описано API для программистов на C и C++, которые хотят создавать модули расширения или встраивать Python. Оно является дополнением к [Расширение и встраивание интерпретатора Python](https://python-all.ru/3.14/extending/index.html#extending-index), в котором описаны общие принципы написания расширений, но нет подробной документации по функциям API.1011- [Введение](https://python-all.ru/3.14/c-api/intro.html)1213  - [Совместимость версий языка](https://python-all.ru/3.14/c-api/intro.html#language-version-compatibility)14  - [Стандарты кодирования](https://python-all.ru/3.14/c-api/intro.html#coding-standards)15  - [Заголовочные файлы](https://python-all.ru/3.14/c-api/intro.html#include-files)16  - [Полезные макросы](https://python-all.ru/3.14/c-api/intro.html#useful-macros)17  - [Объекты, типы и счетчики ссылок](https://python-all.ru/3.14/c-api/intro.html#objects-types-and-reference-counts)18  - [Исключения](https://python-all.ru/3.14/c-api/intro.html#exceptions)19  - [Встраивание Python](https://python-all.ru/3.14/c-api/intro.html#embedding-python)20  - [Отладочные сборки](https://python-all.ru/3.14/c-api/intro.html#debugging-builds)21  - [Рекомендуемые сторонние инструменты](https://python-all.ru/3.14/c-api/intro.html#recommended-third-party-tools)22- [Стабильность C API](https://python-all.ru/3.14/c-api/stable.html)2324  - [Нестабильное C API](https://python-all.ru/3.14/c-api/stable.html#unstable-c-api)25  - [Стабильный ABI](https://python-all.ru/3.14/c-api/stable.html#stable-application-binary-interface)26  - [Особенности платформ](https://python-all.ru/3.14/c-api/stable.html#platform-considerations)27  - [Содержимое ограниченного API](https://python-all.ru/3.14/c-api/stable.html#contents-of-limited-api)28- [Очень высокоуровневый слой](https://python-all.ru/3.14/c-api/veryhigh.html)2930  - [Доступные стартовые символы](https://python-all.ru/3.14/c-api/veryhigh.html#available-start-symbols)31  - [Влияние на стек](https://python-all.ru/3.14/c-api/veryhigh.html#stack-effects)32- [Подсчёт ссылок](https://python-all.ru/3.14/c-api/refcounting.html)33- [Обработка исключений](https://python-all.ru/3.14/c-api/exceptions.html)3435  - [Вывод и очистка](https://python-all.ru/3.14/c-api/exceptions.html#printing-and-clearing)36  - [Возбуждение исключений](https://python-all.ru/3.14/c-api/exceptions.html#raising-exceptions)37  - [Выдача предупреждений](https://python-all.ru/3.14/c-api/exceptions.html#issuing-warnings)38  - [Запрос индикатора ошибки](https://python-all.ru/3.14/c-api/exceptions.html#querying-the-error-indicator)39  - [Обработка сигналов](https://python-all.ru/3.14/c-api/exceptions.html#signal-handling)40  - [Классы исключений](https://python-all.ru/3.14/c-api/exceptions.html#exception-classes)41  - [Объекты исключений](https://python-all.ru/3.14/c-api/exceptions.html#exception-objects)42  - [Объекты исключений Unicode](https://python-all.ru/3.14/c-api/exceptions.html#unicode-exception-objects)43  - [Управление рекурсией](https://python-all.ru/3.14/c-api/exceptions.html#recursion-control)44  - [Типы исключений и предупреждений](https://python-all.ru/3.14/c-api/exceptions.html#exception-and-warning-types)45  - [Трассировки](https://python-all.ru/3.14/c-api/exceptions.html#tracebacks)46- [Определение модулей-расширений](https://python-all.ru/3.14/c-api/extension-modules.html)4748  - [Несколько экземпляров модуля](https://python-all.ru/3.14/c-api/extension-modules.html#multiple-module-instances)49  - [Функция инициализации](https://python-all.ru/3.14/c-api/extension-modules.html#initialization-function)50  - [Многофазная инициализация](https://python-all.ru/3.14/c-api/extension-modules.html#multi-phase-initialization)51  - [Устаревшая однофазная инициализация](https://python-all.ru/3.14/c-api/extension-modules.html#legacy-single-phase-initialization)52- [Утилиты](https://python-all.ru/3.14/c-api/utilities.html)5354  - [Утилиты операционной системы](https://python-all.ru/3.14/c-api/sys.html)55  - [Системные функции](https://python-all.ru/3.14/c-api/sys.html#system-functions)56  - [Управление процессами](https://python-all.ru/3.14/c-api/sys.html#process-control)57  - [Импорт модулей](https://python-all.ru/3.14/c-api/import.html)58  - [Поддержка маршалинга данных](https://python-all.ru/3.14/c-api/marshal.html)59  - [Разбор аргументов и сборка значений](https://python-all.ru/3.14/c-api/arg.html)60  - [Преобразование и форматирование строк](https://python-all.ru/3.14/c-api/conversion.html)61  - [Классификация и преобразование символов](https://python-all.ru/3.14/c-api/conversion.html#character-classification-and-conversion)62  - [PyHash API](https://python-all.ru/3.14/c-api/hash.html)63  - [Рефлексия](https://python-all.ru/3.14/c-api/reflection.html)64  - [Реестр кодировок и вспомогательные функции](https://python-all.ru/3.14/c-api/codec.html)65  - [PyTime C API](https://python-all.ru/3.14/c-api/time.html)66  - [Поддержка карт производительности](https://python-all.ru/3.14/c-api/perfmaps.html)67- [Слой абстрактных объектов](https://python-all.ru/3.14/c-api/abstract.html)6869  - [Протокол объекта](https://python-all.ru/3.14/c-api/object.html)70  - [Протокол вызова](https://python-all.ru/3.14/c-api/call.html)71  - [Протокол чисел](https://python-all.ru/3.14/c-api/number.html)72  - [Протокол последовательностей](https://python-all.ru/3.14/c-api/sequence.html)73  - [Протокол отображений](https://python-all.ru/3.14/c-api/mapping.html)74  - [Протокол итератора](https://python-all.ru/3.14/c-api/iter.html)75  - [Протокол буфера](https://python-all.ru/3.14/c-api/buffer.html)76- [Слой конкретных объектов](https://python-all.ru/3.14/c-api/concrete.html)7778  - [Базовые объекты](https://python-all.ru/3.14/c-api/concrete.html#fundamental-objects)79  - [Числовые объекты](https://python-all.ru/3.14/c-api/concrete.html#numeric-objects)80  - [Объекты последовательностей](https://python-all.ru/3.14/c-api/concrete.html#sequence-objects)81  - [Объекты контейнеров](https://python-all.ru/3.14/c-api/concrete.html#container-objects)82  - [Объекты функций](https://python-all.ru/3.14/c-api/concrete.html#function-objects)83  - [Прочие объекты](https://python-all.ru/3.14/c-api/concrete.html#other-objects)84  - [C API для модулей расширения](https://python-all.ru/3.14/c-api/concrete.html#c-api-for-extension-modules)85- [Инициализация и завершение интерпретатора](https://python-all.ru/3.14/c-api/interp-lifecycle.html)8687  - [Перед инициализацией Python](https://python-all.ru/3.14/c-api/interp-lifecycle.html#before-python-initialization)88  - [Глобальные переменные конфигурации](https://python-all.ru/3.14/c-api/interp-lifecycle.html#global-configuration-variables)89  - [Инициализация и финализация интерпретатора](https://python-all.ru/3.14/c-api/interp-lifecycle.html#initializing-and-finalizing-the-interpreter)90  - [Предостережения относительно финализации во время выполнения](https://python-all.ru/3.14/c-api/interp-lifecycle.html#cautions-regarding-runtime-finalization)91  - [Параметры уровня процесса](https://python-all.ru/3.14/c-api/interp-lifecycle.html#process-wide-parameters)92- [Состояния потоков и глобальная блокировка интерпретатора](https://python-all.ru/3.14/c-api/threads.html)9394  - [Отсоединение состояния потока от кода расширения](https://python-all.ru/3.14/c-api/threads.html#detaching-the-thread-state-from-extension-code)95  - [Потоки, созданные не в Python](https://python-all.ru/3.14/c-api/threads.html#non-python-created-threads)96  - [Устаревший API](https://python-all.ru/3.14/c-api/threads.html#legacy-api)97  - [Предостережения о fork()](https://python-all.ru/3.14/c-api/threads.html#cautions-about-fork)98  - [API высокого уровня](https://python-all.ru/3.14/c-api/threads.html#high-level-apis)99  - [API состояния GIL](https://python-all.ru/3.14/c-api/threads.html#gil-state-apis)100  - [API низкого уровня](https://python-all.ru/3.14/c-api/threads.html#low-level-apis)101- [Асинхронные уведомления](https://python-all.ru/3.14/c-api/threads.html#asynchronous-notifications)102- [API потоков операционной системы](https://python-all.ru/3.14/c-api/threads.html#operating-system-thread-apis)103- [Примитивы синхронизации](https://python-all.ru/3.14/c-api/synchronization.html)104105  - [API критической секции Python](https://python-all.ru/3.14/c-api/synchronization.html#python-critical-section-api)106  - [Устаревшие API блокировок](https://python-all.ru/3.14/c-api/synchronization.html#legacy-locking-apis)107- [Поддержка локального хранилища потоков](https://python-all.ru/3.14/c-api/tls.html)108109  - [API хранилища, специфичного для потоков](https://python-all.ru/3.14/c-api/tls.html#thread-specific-storage-api)110  - [Динамическое выделение памяти](https://python-all.ru/3.14/c-api/tls.html#dynamic-allocation)111  - [Методы](https://python-all.ru/3.14/c-api/tls.html#methods)112  - [Устаревшие API](https://python-all.ru/3.14/c-api/tls.html#legacy-apis)113- [Несколько интерпретаторов в процессе Python](https://python-all.ru/3.14/c-api/subinterpreters.html)114115  - [GIL для каждого интерпретатора](https://python-all.ru/3.14/c-api/subinterpreters.html#a-per-interpreter-gil)116  - [Ошибки и предостережения](https://python-all.ru/3.14/c-api/subinterpreters.html#bugs-and-caveats)117  - [API высокого уровня](https://python-all.ru/3.14/c-api/subinterpreters.html#high-level-apis)118  - [API низкого уровня](https://python-all.ru/3.14/c-api/subinterpreters.html#low-level-apis)119  - [Расширенная поддержка отладчика](https://python-all.ru/3.14/c-api/subinterpreters.html#advanced-debugger-support)120- [Профилирование и трассировка](https://python-all.ru/3.14/c-api/profiling.html)121- [Трассировка ссылок](https://python-all.ru/3.14/c-api/profiling.html#reference-tracing)122- [Конфигурация инициализации Python](https://python-all.ru/3.14/c-api/init_config.html)123124  - [PyInitConfig C API](https://python-all.ru/3.14/c-api/init_config.html#pyinitconfig-c-api)125  - [Параметры конфигурации](https://python-all.ru/3.14/c-api/init_config.html#configuration-options)126  - [API конфигурации времени выполнения Python](https://python-all.ru/3.14/c-api/init_config.html#runtime-python-configuration-api)127  - [PyConfig C API](https://python-all.ru/3.14/c-api/init_config.html#pyconfig-c-api)128  - [Py\_GetArgcArgv()](https://python-all.ru/3.14/c-api/init_config.html#py-getargcargv)129  - [Отложенное выполнение главного модуля](https://python-all.ru/3.14/c-api/init_config.html#delaying-main-module-execution)130- [Управление памятью](https://python-all.ru/3.14/c-api/memory.html)131132  - [Обзор](https://python-all.ru/3.14/c-api/memory.html#overview)133  - [Домены аллокаторов](https://python-all.ru/3.14/c-api/memory.html#allocator-domains)134  - [Интерфейс низкоуровневой памяти](https://python-all.ru/3.14/c-api/memory.html#raw-memory-interface)135  - [Интерфейс памяти](https://python-all.ru/3.14/c-api/memory.html#memory-interface)136  - [Аллокаторы объектов](https://python-all.ru/3.14/c-api/memory.html#object-allocators)137  - [Аллокаторы памяти по умолчанию](https://python-all.ru/3.14/c-api/memory.html#default-memory-allocators)138  - [Настройка аллокаторов памяти](https://python-all.ru/3.14/c-api/memory.html#customize-memory-allocators)139  - [Отладочные перехватчики аллокаторов памяти Python](https://python-all.ru/3.14/c-api/memory.html#debug-hooks-on-the-python-memory-allocators)140  - [Аллокатор pymalloc](https://python-all.ru/3.14/c-api/memory.html#the-pymalloc-allocator)141  - [Аллокатор mimalloc](https://python-all.ru/3.14/c-api/memory.html#the-mimalloc-allocator)142  - [C API модуля tracemalloc](https://python-all.ru/3.14/c-api/memory.html#tracemalloc-c-api)143  - [Примеры](https://python-all.ru/3.14/c-api/memory.html#examples)144- [Поддержка реализации объектов](https://python-all.ru/3.14/c-api/objimpl.html)145146  - [Выделение объектов в куче](https://python-all.ru/3.14/c-api/allocation.html)147  - [Жизненный цикл объекта](https://python-all.ru/3.14/c-api/lifecycle.html)148  - [Общие структуры объектов](https://python-all.ru/3.14/c-api/structures.html)149  - [Структуры объектов типов](https://python-all.ru/3.14/c-api/typeobj.html)150  - [Поддержка циклической сборки мусора](https://python-all.ru/3.14/c-api/gcsupport.html)151- [Версионирование API и ABI](https://python-all.ru/3.14/c-api/apiabiversion.html)152153  - [Константы версии времени сборки](https://python-all.ru/3.14/c-api/apiabiversion.html#build-time-version-constants)154  - [Версия времени выполнения](https://python-all.ru/3.14/c-api/apiabiversion.html#run-time-version)155  - [Макросы упаковки битов](https://python-all.ru/3.14/c-api/apiabiversion.html#bit-packing-macros)156- [Мониторинг C API](https://python-all.ru/3.14/c-api/monitoring.html)157- [Генерация событий выполнения](https://python-all.ru/3.14/c-api/monitoring.html#generating-execution-events)158159  - [Управление состоянием мониторинга](https://python-all.ru/3.14/c-api/monitoring.html#managing-the-monitoring-state)160