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

---

# Справочное руководство по Python/C API

В данном руководстве описано API для программистов на C и C++, которые хотят создавать модули расширения или встраивать Python. Оно является дополнением к [Расширение и встраивание интерпретатора Python](https://python-all.ru/3.9/extending/index.html#extending-index), в котором описаны общие принципы написания расширений, но нет подробной документации по функциям API.

- [Введение](https://python-all.ru/3.9/c-api/intro.html)

  - [Стандарты кодирования](https://python-all.ru/3.9/c-api/intro.html#coding-standards)
  - [Заголовочные файлы](https://python-all.ru/3.9/c-api/intro.html#include-files)
  - [Полезные макросы](https://python-all.ru/3.9/c-api/intro.html#useful-macros)
  - [Объекты, типы и счетчики ссылок](https://python-all.ru/3.9/c-api/intro.html#objects-types-and-reference-counts)
  - [Исключения](https://python-all.ru/3.9/c-api/intro.html#exceptions)
  - [Встраивание Python](https://python-all.ru/3.9/c-api/intro.html#embedding-python)
  - [Отладочные сборки](https://python-all.ru/3.9/c-api/intro.html#debugging-builds)
- [Стабильный ABI](https://python-all.ru/3.9/c-api/stable.html)
- [Очень высокоуровневый слой](https://python-all.ru/3.9/c-api/veryhigh.html)
- [Подсчёт ссылок](https://python-all.ru/3.9/c-api/refcounting.html)
- [Обработка исключений](https://python-all.ru/3.9/c-api/exceptions.html)

  - [Вывод и очистка](https://python-all.ru/3.9/c-api/exceptions.html#printing-and-clearing)
  - [Возбуждение исключений](https://python-all.ru/3.9/c-api/exceptions.html#raising-exceptions)
  - [Выдача предупреждений](https://python-all.ru/3.9/c-api/exceptions.html#issuing-warnings)
  - [Запрос индикатора ошибки](https://python-all.ru/3.9/c-api/exceptions.html#querying-the-error-indicator)
  - [Обработка сигналов](https://python-all.ru/3.9/c-api/exceptions.html#signal-handling)
  - [Классы исключений](https://python-all.ru/3.9/c-api/exceptions.html#exception-classes)
  - [Объекты исключений](https://python-all.ru/3.9/c-api/exceptions.html#exception-objects)
  - [Объекты исключений Unicode](https://python-all.ru/3.9/c-api/exceptions.html#unicode-exception-objects)
  - [Управление рекурсией](https://python-all.ru/3.9/c-api/exceptions.html#recursion-control)
  - [Стандартные исключения](https://python-all.ru/3.9/c-api/exceptions.html#standard-exceptions)
  - [Стандартные категории предупреждений](https://python-all.ru/3.9/c-api/exceptions.html#standard-warning-categories)
- [Утилиты](https://python-all.ru/3.9/c-api/utilities.html)

  - [Утилиты операционной системы](https://python-all.ru/3.9/c-api/sys.html)
  - [Системные функции](https://python-all.ru/3.9/c-api/sys.html#system-functions)
  - [Управление процессами](https://python-all.ru/3.9/c-api/sys.html#process-control)
  - [Импорт модулей](https://python-all.ru/3.9/c-api/import.html)
  - [Поддержка маршалинга данных](https://python-all.ru/3.9/c-api/marshal.html)
  - [Разбор аргументов и сборка значений](https://python-all.ru/3.9/c-api/arg.html)
  - [Преобразование и форматирование строк](https://python-all.ru/3.9/c-api/conversion.html)
  - [Рефлексия](https://python-all.ru/3.9/c-api/reflection.html)
  - [Реестр кодировок и вспомогательные функции](https://python-all.ru/3.9/c-api/codec.html)
- [Слой абстрактных объектов](https://python-all.ru/3.9/c-api/abstract.html)

  - [Протокол объекта](https://python-all.ru/3.9/c-api/object.html)
  - [Протокол вызова](https://python-all.ru/3.9/c-api/call.html)
  - [Протокол чисел](https://python-all.ru/3.9/c-api/number.html)
  - [Протокол последовательностей](https://python-all.ru/3.9/c-api/sequence.html)
  - [Протокол отображений](https://python-all.ru/3.9/c-api/mapping.html)
  - [Протокол итератора](https://python-all.ru/3.9/c-api/iter.html)
  - [Протокол буфера](https://python-all.ru/3.9/c-api/buffer.html)
  - [Старый буферный протокол](https://python-all.ru/3.9/c-api/objbuffer.html)
- [Слой конкретных объектов](https://python-all.ru/3.9/c-api/concrete.html)

  - [Базовые объекты](https://python-all.ru/3.9/c-api/concrete.html#fundamental-objects)
  - [Числовые объекты](https://python-all.ru/3.9/c-api/concrete.html#numeric-objects)
  - [Объекты последовательностей](https://python-all.ru/3.9/c-api/concrete.html#sequence-objects)
  - [Объекты контейнеров](https://python-all.ru/3.9/c-api/concrete.html#container-objects)
  - [Объекты функций](https://python-all.ru/3.9/c-api/concrete.html#function-objects)
  - [Прочие объекты](https://python-all.ru/3.9/c-api/concrete.html#other-objects)
- [Инициализация, финализация и потоки](https://python-all.ru/3.9/c-api/init.html)

  - [Перед инициализацией Python](https://python-all.ru/3.9/c-api/init.html#before-python-initialization)
  - [Глобальные переменные конфигурации](https://python-all.ru/3.9/c-api/init.html#global-configuration-variables)
  - [Инициализация и финализация интерпретатора](https://python-all.ru/3.9/c-api/init.html#initializing-and-finalizing-the-interpreter)
  - [Параметры уровня процесса](https://python-all.ru/3.9/c-api/init.html#process-wide-parameters)
  - [Состояние потока и глобальная блокировка интерпретатора](https://python-all.ru/3.9/c-api/init.html#thread-state-and-the-global-interpreter-lock)
  - [Поддержка под-интерпретаторов](https://python-all.ru/3.9/c-api/init.html#sub-interpreter-support)
  - [Асинхронные уведомления](https://python-all.ru/3.9/c-api/init.html#asynchronous-notifications)
  - [Профилирование и трассировка](https://python-all.ru/3.9/c-api/init.html#profiling-and-tracing)
  - [Расширенная поддержка отладчика](https://python-all.ru/3.9/c-api/init.html#advanced-debugger-support)
  - [Поддержка локального хранилища потоков](https://python-all.ru/3.9/c-api/init.html#thread-local-storage-support)
- [Конфигурация инициализации Python](https://python-all.ru/3.9/c-api/init_config.html)

  - [PyWideStringList](https://python-all.ru/3.9/c-api/init_config.html#pywidestringlist)
  - [PyStatus](https://python-all.ru/3.9/c-api/init_config.html#pystatus)
  - [PyPreConfig](https://python-all.ru/3.9/c-api/init_config.html#pypreconfig)
  - [Преинициализация с PyPreConfig](https://python-all.ru/3.9/c-api/init_config.html#preinitialization-with-pypreconfig)
  - [PyConfig](https://python-all.ru/3.9/c-api/init_config.html#pyconfig)
  - [Инициализация с помощью PyConfig](https://python-all.ru/3.9/c-api/init_config.html#initialization-with-pyconfig)
  - [Изолированная конфигурация](https://python-all.ru/3.9/c-api/init_config.html#isolated-configuration)
  - [Конфигурация Python](https://python-all.ru/3.9/c-api/init_config.html#python-configuration)
  - [Конфигурация путей](https://python-all.ru/3.9/c-api/init_config.html#path-configuration)
  - [Py\_RunMain()](https://python-all.ru/3.9/c-api/init_config.html#py-runmain)
  - [Py\_GetArgcArgv()](https://python-all.ru/3.9/c-api/init_config.html#py-getargcargv)
  - [Приватный предварительный API многофазной инициализации](https://python-all.ru/3.9/c-api/init_config.html#multi-phase-initialization-private-provisional-api)
- [Управление памятью](https://python-all.ru/3.9/c-api/memory.html)

  - [Обзор](https://python-all.ru/3.9/c-api/memory.html#overview)
  - [Интерфейс низкоуровневой памяти](https://python-all.ru/3.9/c-api/memory.html#raw-memory-interface)
  - [Интерфейс памяти](https://python-all.ru/3.9/c-api/memory.html#memory-interface)
  - [Аллокаторы объектов](https://python-all.ru/3.9/c-api/memory.html#object-allocators)
  - [Аллокаторы памяти по умолчанию](https://python-all.ru/3.9/c-api/memory.html#default-memory-allocators)
  - [Настройка аллокаторов памяти](https://python-all.ru/3.9/c-api/memory.html#customize-memory-allocators)
  - [Аллокатор pymalloc](https://python-all.ru/3.9/c-api/memory.html#the-pymalloc-allocator)
  - [C API модуля tracemalloc](https://python-all.ru/3.9/c-api/memory.html#tracemalloc-c-api)
  - [Примеры](https://python-all.ru/3.9/c-api/memory.html#examples)
- [Поддержка реализации объектов](https://python-all.ru/3.9/c-api/objimpl.html)

  - [Выделение объектов в куче](https://python-all.ru/3.9/c-api/allocation.html)
  - [Общие структуры объектов](https://python-all.ru/3.9/c-api/structures.html)
  - [Объекты типов](https://python-all.ru/3.9/c-api/typeobj.html)
  - [Структуры числовых объектов](https://python-all.ru/3.9/c-api/typeobj.html#number-object-structures)
  - [Структуры объектов отображений](https://python-all.ru/3.9/c-api/typeobj.html#mapping-object-structures)
  - [Структуры объектов последовательностей](https://python-all.ru/3.9/c-api/typeobj.html#sequence-object-structures)
  - [Структуры буферных объектов](https://python-all.ru/3.9/c-api/typeobj.html#buffer-object-structures)
  - [Структуры асинхронных объектов](https://python-all.ru/3.9/c-api/typeobj.html#async-object-structures)
  - [typedefs типов слотов](https://python-all.ru/3.9/c-api/typeobj.html#slot-type-typedefs)
  - [Примеры](https://python-all.ru/3.9/c-api/typeobj.html#examples)
  - [Поддержка циклической сборки мусора](https://python-all.ru/3.9/c-api/gcsupport.html)
- [Версионирование API и ABI](https://python-all.ru/3.9/c-api/apiabiversion.html)
