On this page
  1. types.CapsuleType
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

types.CapsuleType

Prev: types.BuiltinMethodType | Up: types | Next: types.CellType
Rel: types.AsyncGeneratorType, types.BuiltinFunctionType, types.BuiltinMethodType, types.CellType
Ref: docs.python.org — types.CapsuleType
Tags: #public #python3 #stdlib #types


Import

import types
from types import CapsuleType

Signature & Overview

types.CapsuleType()

Capsule objects let you wrap a C "void *" pointer in a Python object. They're a way of passing data through the Python interpreter without creating your own custom type.

Usage

import types

# Python 3.13+: type of C API PyCapsule objects (e.g. pyexpat.expat_CAPI)
assert hasattr(types, 'CapsuleType') or True

Gotchas

REPL Inspect

from types import CapsuleType
help(CapsuleType)

Linked from

Related notes