ContentsIndex
Python.Utils
Portability portable
Stability provisional
Maintainer jgoerzen@complete.org
Contents
Objects
Exceptions
Environment
Description

Python low-level utilities

Written by John Goerzen, jgoerzen@complete.org

Please use sparingly and with caution. The documentation for their behavior should be considered to be the source code.

Synopsis
fromCPyObject :: Ptr CPyObject -> IO PyObject
withPyObject :: PyObject -> (Ptr CPyObject -> IO b) -> IO b
maybeWithPyObject :: Maybe PyObject -> (Ptr CPyObject -> IO b) -> IO b
raisePyException :: IO a
checkCInt :: CInt -> IO CInt
getDefaultGlobals :: IO PyObject
pyImport_AddModule :: String -> IO PyObject
pyModule_GetDict :: PyObject -> IO PyObject
Objects
fromCPyObject :: Ptr CPyObject -> IO PyObject
Convert a Ptr CPyObject to a PyObject.
withPyObject :: PyObject -> (Ptr CPyObject -> IO b) -> IO b
Uses a PyObject in a function that needs Ptr CPyObject.
maybeWithPyObject :: Maybe PyObject -> (Ptr CPyObject -> IO b) -> IO b
Same as withPyObject, but uses nullPtr if the input is Nothing.
Exceptions
raisePyException :: IO a
Called when a Python exception has been detected. It will raise the exception in Haskell.
checkCInt :: CInt -> IO CInt
Called to make sure the passed CInt isn't -1. Raise an exception if it is.
Environment
getDefaultGlobals :: IO PyObject
Returns the default globals environment.
pyImport_AddModule :: String -> IO PyObject
Wrapper around C PyImport_AddModule, which looks up an existing module
pyModule_GetDict :: PyObject -> IO PyObject
Gets the dict associated with a module.
Produced by Haddock version 0.6