I have a C Extension that receives and accepts PyCapsule objects.
In my python wrapper, how can I check if a python object is of the PyCapsule type object?
>>> # My C extension
>>> foo = Foo()
>>> capsule = foo.to_capsule() # returns a PyCapsule object from the C extension
>>> capsule
<capsule object "foo" at 0xf707df08>
>>> type(capsule)
<class 'PyCapsule'>
isinstance(capsule, PyCapsule)
NameError: name 'PyCapsule' is not defined
What I'm trying to do is write a function like:
def push_capsule(capsule):
# check that the `capsule` is of type PyCapsule
# c_extension.push_capsule(capsule)