| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
CPython.Types.Capsule
Synopsis
- data Capsule
- capsuleType :: Type
- getPointer :: Capsule -> Maybe Text -> IO (Ptr ())
- getContext :: Capsule -> IO (Ptr ())
- getName :: Capsule -> IO (Maybe Text)
- importNamed :: Text -> Bool -> IO (Maybe (Ptr ()))
- isValid :: Capsule -> Maybe Text -> IO Bool
- setPointer :: Capsule -> Ptr () -> IO ()
- setContext :: Capsule -> Ptr () -> IO ()
Documentation
Instances
| Concrete Capsule Source # | |
Defined in CPython.Types.Capsule Methods concreteType :: Capsule -> Type | |
| Object Capsule Source # | |
Defined in CPython.Types.Capsule | |
capsuleType :: Type Source #
getContext :: Capsule -> IO (Ptr ()) Source #
Return the current context stored in the capsule, which might be NULL.
getName :: Capsule -> IO (Maybe Text) Source #
Return the current name stored in the capsule, which might be Nothing.
importNamed :: Text -> Bool -> IO (Maybe (Ptr ())) Source #
Import a pointer to a C object from a capsule attribute in a module.
The name parameter should specify the full name to the attribute, as in
"module.attribute". The name stored in the capsule must match this
string exactly. If the second parameter is False, import the module
without blocking (using PyImport_ImportModuleNoBlock()). Otherwise,
imports the module conventionally (using PyImport_ImportModule()).
Return the capsule’s internal pointer on success. On failure, throw
an exception. If the module could not be imported, and if importing in
non-blocking mode, returns Nothing.
isValid :: Capsule -> Maybe Text -> IO Bool Source #
Determines whether or not a capsule is valid. A valid capsule's type is
capsuleType, has a non-NULL pointer stored in it, and its internal name
matches the name parameter. (See getPointer for information on how
capsule names are compared.)
In other words, if isValid returns True, calls to any of the
accessors (any function starting with get) are guaranteed to succeed.