Python/C API 參考手冊
*********************

對於想要編寫擴充模組或是嵌入 Python 的 C 和 C++ 程式設計師們，這份手冊
記錄了可使用的 API（應用程式介面）。在擴充和嵌入 Python 直譯器中也有相
關的內容，它描述了編寫擴充的一般原則，但並沒有詳細說明 API 函式。

* 簡介

  * 語言版本相容性

  * 編寫標準

  * 引入檔案 (include files)

  * 有用的巨集

  * 物件、型別和參照計數

  * 例外

  * 嵌入式Python

  * 除錯建置

  * 建議的第三方工具

* C API and ABI Stability

  * 不穩定的 C API

  * Stable Application Binary Interfaces

  * 平台注意事項

  * ABI Checking

  * 受限 API 的內容

* The Very High Level Layer

  * 可用的起始符號

  * Stack Effects

* 參照計數

* 例外處理

  * Printing and clearing

  * 引發例外

  * 發出警告

  * Querying the error indicator

  * 訊號處理

  * 例外類別

  * 例外物件

  * Unicode 例外物件

  * 遞迴控制

  * 例外和警告型別

  * Tracebacks

* Defining extension modules

  * Extension export hook

  * Multi-phase initialization

  * Multiple module instances

  * "PyInit" function

* Definition slots

  * Convenience macros

  * Common slot IDs

* 工具

  * 作業系統工具

  * 系統函式

  * 行程控制

  * 引入模組

  * 資料 marshal 操作的支援

  * 剖析引數與建置數值

  * 字串轉換與格式化

  * Character classification and conversion

  * PyHash API

  * Reflection

  * 編解碼器註冊表和支援函式

  * PyTime C API

  * 對 Perf Map 的支援

* 抽象物件層 (Abstract Objects Layer)

  * 物件協定

  * 呼叫協定 (Call Protocol)

  * 數字協定

  * 序列協定

  * 對映協定

  * 疊代器協定

  * 緩衝協定 (Buffer Protocol)

* 具體物件層

  * 基礎物件

  * 數值物件

  * 序列物件

  * 容器物件

  * 函式物件

  * 其他物件

  * 擴充模組的 C API

* 直譯器的初始化與終結化

  * Python 初始化之前

  * Global configuration variables

  * Initializing and finalizing the interpreter

  * Cautions regarding interpreter finalization

  * Interpreter views

  * Process-wide parameters

* 執行緒狀態與全域直譯器鎖

  * Detaching the thread state from extension code

  * Using the C API from foreign threads

  * GIL 狀態 API

  * Cautions about fork()

  * High-level APIs

  * 低階 API

* Asynchronous notifications

* 作業系統執行緒 API

* 同步原語

  * Python critical section API

  * Legacy locking APIs

* 執行緒局部儲存的支援

  * Thread-specific storage API

  * Dynamic allocation

  * 方法

  * Legacy APIs

* Python 行程中的多重直譯器

  * A per-interpreter GIL

  * Bugs and caveats

  * 高階 API

  * 低階 API

  * 進階偵錯器支援

* 性能分析與追蹤

* 參照追蹤

* Python 初始化設定

  * PyInitConfig C API

  * Configuration Options

  * Runtime Python configuration API

  * PyConfig C API

  * Py_GetArgcArgv()

  * Multi-Phase Initialization Private Provisional API

* 記憶體管理

  * 總覽

  * Allocator Domains

  * Raw Memory Interface

  * 記憶體介面

  * Object allocators

  * Default Memory Allocators

  * Customize Memory Allocators

  * Debug hooks on the Python memory allocators

  * The pymalloc allocator

  * The mimalloc allocator

  * tracemalloc C API

  * 範例

* 物件實作支援

  * Allocating objects on the heap

  * 物件生命週期

  * 通用物件結構

  * 型別物件結構

  * 循環垃圾回收的支援

* API 和 ABI 版本管理

  * Build-time version constants

  * Run-time version

  * Bit-packing macros

* 監控 C API

* Generating Execution Events

  * Managing the Monitoring State
