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

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

* 簡介

  * 語言版本相容性

  * 編寫標準

  * 引入檔案 (include files)

  * 有用的巨集

  * 物件、型別和參照計數

  * 例外

  * 嵌入式Python

  * 除錯建置

  * 建議的第三方工具

* C API 穩定性

  * 不穩定的 C API

  * 穩定的應用程式二進位介面

  * 平台注意事項

  * 受限 API 的內容

* The Very High Level Layer

  * 可用的起始符號

  * Stack Effects

* 參照計數

* 例外處理

  * Printing and clearing

  * 引發例外

  * 發出警告

  * Querying the error indicator

  * 訊號處理

  * 例外類別

  * 例外物件

  * Unicode 例外物件

  * 遞迴控制

  * 例外和警告型別

  * Tracebacks

* Defining extension modules

  * Multiple module instances

  * Initialization function

  * Multi-phase initialization

  * Legacy single-phase initialization

* 工具

  * 作業系統工具

  * 系統函式

  * 行程控制

  * 引入模組

  * 資料 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

  * Process-wide parameters

  * Thread State and the Global Interpreter Lock

  * Sub-interpreter support

  * Asynchronous Notifications

  * Profiling and Tracing

  * Reference tracing

  * Advanced Debugger Support

  * Thread Local Storage Support

  * Synchronization Primitives

  * Operating System Thread APIs

* Python 初始化設定

  * PyInitConfig C API

  * Configuration Options

  * Runtime Python configuration API

  * PyConfig C API

  * Py_GetArgcArgv()

  * Delaying main module execution

* 記憶體管理

  * 總覽

  * 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

  * 範例

* 物件實作支援

  * 在 heap 上分配物件

  * 物件生命週期

  * 通用物件結構

  * 型別物件結構

  * 循環垃圾回收的支援

* API 和 ABI 版本管理

  * Build-time version constants

  * Run-time version

  * Bit-packing macros

* 監控 C API

* Generating Execution Events

  * Managing the Monitoring State
