Closed
Description
Feature or enhancement
Proposal:
While not common, capsule objects can appear in APIs. For example the Python DLPack protocol specifies a __dlpack__
method returning a capsule object.
It would therefore be nice to add typing support for capsules. Ideally it should be parameterable by the capsule name, because it often serves as a discriminator for the actual C type under the capsule.
from typing import Capsule, Protocol
class DLPackExportable(Protocol):
def __dlpack__(self) -> Capsule["dltensor"]:
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response