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

index.md

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

1> **Источник:** https://python-all.ru/3.15/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.15/extending/index.html#extending-index), в котором описаны общие принципы написания расширений, но нет подробной документации по функциям API.1011- [Введение](https://python-all.ru/3.15/c-api/intro.html)1213  - [Совместимость версий языка](https://python-all.ru/3.15/c-api/intro.html#language-version-compatibility)14  - [Стандарты кодирования](https://python-all.ru/3.15/c-api/intro.html#coding-standards)15  - [Заголовочные файлы](https://python-all.ru/3.15/c-api/intro.html#include-files)16  - [Полезные макросы](https://python-all.ru/3.15/c-api/intro.html#useful-macros)17  - [Объекты, типы и счетчики ссылок](https://python-all.ru/3.15/c-api/intro.html#objects-types-and-reference-counts)18  - [Исключения](https://python-all.ru/3.15/c-api/intro.html#exceptions)19  - [Встраивание Python](https://python-all.ru/3.15/c-api/intro.html#embedding-python)20  - [Отладочные сборки](https://python-all.ru/3.15/c-api/intro.html#debugging-builds)21  - [Рекомендуемые сторонние инструменты](https://python-all.ru/3.15/c-api/intro.html#recommended-third-party-tools)22- [Стабильность C API и ABI](https://python-all.ru/3.15/c-api/stable.html)2324  - [Нестабильное C API](https://python-all.ru/3.15/c-api/stable.html#unstable-c-api)25  - [Стабильные интерфейсы двоичных приложений](https://python-all.ru/3.15/c-api/stable.html#stable-application-binary-interfaces)26  - [Особенности платформ](https://python-all.ru/3.15/c-api/stable.html#platform-considerations)27  - [Проверка ABI](https://python-all.ru/3.15/c-api/stable.html#abi-checking)28  - [Содержимое ограниченного API](https://python-all.ru/3.15/c-api/stable.html#contents-of-limited-api)29- [Очень высокоуровневый слой](https://python-all.ru/3.15/c-api/veryhigh.html)3031  - [Доступные стартовые символы](https://python-all.ru/3.15/c-api/veryhigh.html#available-start-symbols)32  - [Влияние на стек](https://python-all.ru/3.15/c-api/veryhigh.html#stack-effects)33- [Подсчёт ссылок](https://python-all.ru/3.15/c-api/refcounting.html)34- [Обработка исключений](https://python-all.ru/3.15/c-api/exceptions.html)3536  - [Вывод и очистка](https://python-all.ru/3.15/c-api/exceptions.html#printing-and-clearing)37  - [Возбуждение исключений](https://python-all.ru/3.15/c-api/exceptions.html#raising-exceptions)38  - [Выдача предупреждений](https://python-all.ru/3.15/c-api/exceptions.html#issuing-warnings)39  - [Запрос индикатора ошибки](https://python-all.ru/3.15/c-api/exceptions.html#querying-the-error-indicator)40  - [Обработка сигналов](https://python-all.ru/3.15/c-api/exceptions.html#signal-handling)41  - [Классы исключений](https://python-all.ru/3.15/c-api/exceptions.html#exception-classes)42  - [Объекты исключений](https://python-all.ru/3.15/c-api/exceptions.html#exception-objects)43  - [Объекты исключений Unicode](https://python-all.ru/3.15/c-api/exceptions.html#unicode-exception-objects)44  - [Управление рекурсией](https://python-all.ru/3.15/c-api/exceptions.html#recursion-control)45  - [Типы исключений и предупреждений](https://python-all.ru/3.15/c-api/exceptions.html#exception-and-warning-types)46  - [Трассировки](https://python-all.ru/3.15/c-api/exceptions.html#tracebacks)47- [Определение модулей-расширений](https://python-all.ru/3.15/c-api/extension-modules.html)4849  - [Хук экспорта расширения](https://python-all.ru/3.15/c-api/extension-modules.html#extension-export-hook)50  - [Многофазная инициализация](https://python-all.ru/3.15/c-api/extension-modules.html#multi-phase-initialization)51  - [Несколько экземпляров модуля](https://python-all.ru/3.15/c-api/extension-modules.html#multiple-module-instances)52  - [функция `PyInit`](https://python-all.ru/3.15/c-api/extension-modules.html#pyinit-function)53- [Слоты определения](https://python-all.ru/3.15/c-api/slots.html)5455  - [Удобные макросы](https://python-all.ru/3.15/c-api/slots.html#convenience-macros)56  - [Общие идентификаторы слотов](https://python-all.ru/3.15/c-api/slots.html#common-slot-ids)57- [Утилиты](https://python-all.ru/3.15/c-api/utilities.html)5859  - [Утилиты операционной системы](https://python-all.ru/3.15/c-api/sys.html)60  - [Системные функции](https://python-all.ru/3.15/c-api/sys.html#system-functions)61  - [Управление процессами](https://python-all.ru/3.15/c-api/sys.html#process-control)62  - [Импорт модулей](https://python-all.ru/3.15/c-api/import.html)63  - [Поддержка маршалинга данных](https://python-all.ru/3.15/c-api/marshal.html)64  - [Разбор аргументов и сборка значений](https://python-all.ru/3.15/c-api/arg.html)65  - [Преобразование и форматирование строк](https://python-all.ru/3.15/c-api/conversion.html)66  - [Классификация и преобразование символов](https://python-all.ru/3.15/c-api/conversion.html#character-classification-and-conversion)67  - [PyHash API](https://python-all.ru/3.15/c-api/hash.html)68  - [Рефлексия](https://python-all.ru/3.15/c-api/reflection.html)69  - [Реестр кодировок и вспомогательные функции](https://python-all.ru/3.15/c-api/codec.html)70  - [PyTime C API](https://python-all.ru/3.15/c-api/time.html)71  - [Поддержка карт производительности](https://python-all.ru/3.15/c-api/perfmaps.html)72- [Слой абстрактных объектов](https://python-all.ru/3.15/c-api/abstract.html)7374  - [Протокол объекта](https://python-all.ru/3.15/c-api/object.html)75  - [Протокол вызова](https://python-all.ru/3.15/c-api/call.html)76  - [Протокол чисел](https://python-all.ru/3.15/c-api/number.html)77  - [Протокол последовательностей](https://python-all.ru/3.15/c-api/sequence.html)78  - [Протокол отображений](https://python-all.ru/3.15/c-api/mapping.html)79  - [Протокол итератора](https://python-all.ru/3.15/c-api/iter.html)80  - [Протокол буфера](https://python-all.ru/3.15/c-api/buffer.html)81- [Слой конкретных объектов](https://python-all.ru/3.15/c-api/concrete.html)8283  - [Базовые объекты](https://python-all.ru/3.15/c-api/concrete.html#fundamental-objects)84  - [Числовые объекты](https://python-all.ru/3.15/c-api/concrete.html#numeric-objects)85  - [Объекты последовательностей](https://python-all.ru/3.15/c-api/concrete.html#sequence-objects)86  - [Объекты контейнеров](https://python-all.ru/3.15/c-api/concrete.html#container-objects)87  - [Объекты функций](https://python-all.ru/3.15/c-api/concrete.html#function-objects)88  - [Прочие объекты](https://python-all.ru/3.15/c-api/concrete.html#other-objects)89  - [C API для модулей расширения](https://python-all.ru/3.15/c-api/concrete.html#c-api-for-extension-modules)90- [Инициализация и завершение интерпретатора](https://python-all.ru/3.15/c-api/interp-lifecycle.html)9192  - [Перед инициализацией Python](https://python-all.ru/3.15/c-api/interp-lifecycle.html#before-python-initialization)93  - [Глобальные переменные конфигурации](https://python-all.ru/3.15/c-api/interp-lifecycle.html#global-configuration-variables)94  - [Инициализация и финализация интерпретатора](https://python-all.ru/3.15/c-api/interp-lifecycle.html#initializing-and-finalizing-the-interpreter)95  - [Предостережения относительно финализации интерпретатора](https://python-all.ru/3.15/c-api/interp-lifecycle.html#cautions-regarding-interpreter-finalization)96  - [Представления интерпретатора](https://python-all.ru/3.15/c-api/interp-lifecycle.html#interpreter-views)97  - [Параметры уровня процесса](https://python-all.ru/3.15/c-api/interp-lifecycle.html#process-wide-parameters)98- [Состояния потоков и глобальная блокировка интерпретатора](https://python-all.ru/3.15/c-api/threads.html)99100  - [Отсоединение состояния потока от кода расширения](https://python-all.ru/3.15/c-api/threads.html#detaching-the-thread-state-from-extension-code)101  - [Использование C API из внешних потоков](https://python-all.ru/3.15/c-api/threads.html#using-the-c-api-from-foreign-threads)102  - [API состояния GIL](https://python-all.ru/3.15/c-api/threads.html#gil-state-apis)103  - [Предостережения о fork()](https://python-all.ru/3.15/c-api/threads.html#cautions-about-fork)104  - [API высокого уровня](https://python-all.ru/3.15/c-api/threads.html#high-level-apis)105  - [API низкого уровня](https://python-all.ru/3.15/c-api/threads.html#low-level-apis)106- [Асинхронные уведомления](https://python-all.ru/3.15/c-api/threads.html#asynchronous-notifications)107- [API потоков операционной системы](https://python-all.ru/3.15/c-api/threads.html#operating-system-thread-apis)108- [Примитивы синхронизации](https://python-all.ru/3.15/c-api/synchronization.html)109110  - [API критической секции Python](https://python-all.ru/3.15/c-api/synchronization.html#python-critical-section-api)111  - [Устаревшие API блокировок](https://python-all.ru/3.15/c-api/synchronization.html#legacy-locking-apis)112- [Поддержка локального хранилища потоков](https://python-all.ru/3.15/c-api/tls.html)113114  - [API хранилища, специфичного для потоков](https://python-all.ru/3.15/c-api/tls.html#thread-specific-storage-api)115  - [Динамическое выделение памяти](https://python-all.ru/3.15/c-api/tls.html#dynamic-allocation)116  - [Методы](https://python-all.ru/3.15/c-api/tls.html#methods)117  - [Устаревшие API](https://python-all.ru/3.15/c-api/tls.html#legacy-apis)118- [Несколько интерпретаторов в процессе Python](https://python-all.ru/3.15/c-api/subinterpreters.html)119120  - [GIL для каждого интерпретатора](https://python-all.ru/3.15/c-api/subinterpreters.html#a-per-interpreter-gil)121  - [Ошибки и предостережения](https://python-all.ru/3.15/c-api/subinterpreters.html#bugs-and-caveats)122  - [API высокого уровня](https://python-all.ru/3.15/c-api/subinterpreters.html#high-level-apis)123  - [API низкого уровня](https://python-all.ru/3.15/c-api/subinterpreters.html#low-level-apis)124  - [Расширенная поддержка отладчика](https://python-all.ru/3.15/c-api/subinterpreters.html#advanced-debugger-support)125- [Профилирование и трассировка](https://python-all.ru/3.15/c-api/profiling.html)126- [Трассировка ссылок](https://python-all.ru/3.15/c-api/profiling.html#reference-tracing)127- [Конфигурация инициализации Python](https://python-all.ru/3.15/c-api/init_config.html)128129  - [PyInitConfig C API](https://python-all.ru/3.15/c-api/init_config.html#pyinitconfig-c-api)130  - [Параметры конфигурации](https://python-all.ru/3.15/c-api/init_config.html#configuration-options)131  - [API конфигурации времени выполнения Python](https://python-all.ru/3.15/c-api/init_config.html#runtime-python-configuration-api)132  - [PyConfig C API](https://python-all.ru/3.15/c-api/init_config.html#pyconfig-c-api)133  - [Py\_GetArgcArgv()](https://python-all.ru/3.15/c-api/init_config.html#py-getargcargv)134  - [Приватный предварительный API многофазной инициализации](https://python-all.ru/3.15/c-api/init_config.html#multi-phase-initialization-private-provisional-api)135- [Управление памятью](https://python-all.ru/3.15/c-api/memory.html)136137  - [Обзор](https://python-all.ru/3.15/c-api/memory.html#overview)138  - [Домены аллокаторов](https://python-all.ru/3.15/c-api/memory.html#allocator-domains)139  - [Интерфейс низкоуровневой памяти](https://python-all.ru/3.15/c-api/memory.html#raw-memory-interface)140  - [Интерфейс памяти](https://python-all.ru/3.15/c-api/memory.html#memory-interface)141  - [Аллокаторы объектов](https://python-all.ru/3.15/c-api/memory.html#object-allocators)142  - [Аллокаторы памяти по умолчанию](https://python-all.ru/3.15/c-api/memory.html#default-memory-allocators)143  - [Настройка аллокаторов памяти](https://python-all.ru/3.15/c-api/memory.html#customize-memory-allocators)144  - [Отладочные перехватчики аллокаторов памяти Python](https://python-all.ru/3.15/c-api/memory.html#debug-hooks-on-the-python-memory-allocators)145  - [Аллокатор pymalloc](https://python-all.ru/3.15/c-api/memory.html#the-pymalloc-allocator)146  - [Аллокатор mimalloc](https://python-all.ru/3.15/c-api/memory.html#the-mimalloc-allocator)147  - [C API модуля tracemalloc](https://python-all.ru/3.15/c-api/memory.html#tracemalloc-c-api)148  - [Примеры](https://python-all.ru/3.15/c-api/memory.html#examples)149- [Поддержка реализации объектов](https://python-all.ru/3.15/c-api/objimpl.html)150151  - [Выделение объектов в куче](https://python-all.ru/3.15/c-api/allocation.html)152  - [Жизненный цикл объекта](https://python-all.ru/3.15/c-api/lifecycle.html)153  - [Общие структуры объектов](https://python-all.ru/3.15/c-api/structures.html)154  - [Структуры объектов типов](https://python-all.ru/3.15/c-api/typeobj.html)155  - [Поддержка циклической сборки мусора](https://python-all.ru/3.15/c-api/gcsupport.html)156- [Версионирование API и ABI](https://python-all.ru/3.15/c-api/apiabiversion.html)157158  - [Константы версии времени сборки](https://python-all.ru/3.15/c-api/apiabiversion.html#build-time-version-constants)159  - [Версия времени выполнения](https://python-all.ru/3.15/c-api/apiabiversion.html#run-time-version)160  - [Макросы упаковки битов](https://python-all.ru/3.15/c-api/apiabiversion.html#bit-packing-macros)161- [Мониторинг C API](https://python-all.ru/3.15/c-api/monitoring.html)162- [Генерация событий выполнения](https://python-all.ru/3.15/c-api/monitoring.html#generating-execution-events)163164  - [Управление состоянием мониторинга](https://python-all.ru/3.15/c-api/monitoring.html#managing-the-monitoring-state)165