MissingPy-0.10.5: Haskell interface to Python

MaintainerJohn Goerzen,

Python.Utils

Contents

Description

Maintainer : jgoerzen@complete.org Stability : provisional Portability: portable

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

Objects

withPyObject :: PyObject -> (Ptr CPyObject -> IO b) -> IO bSource

Uses a PyObject in a function that needs Ptr CPyObject.

maybeWithPyObject :: Maybe PyObject -> (Ptr CPyObject -> IO b) -> IO bSource

Same as withPyObject, but uses nullPtr if the input is Nothing.

Exceptions

raisePyException :: IO aSource

Called when a Python exception has been detected. It will raise the exception in Haskell.

checkCInt :: CInt -> IO CIntSource

Called to make sure the passed CInt isn't -1. Raise an exception if it is.

Environment

getDefaultGlobals :: IO PyObjectSource

Returns the default globals environment.

pyImport_AddModule :: String -> IO PyObjectSource

Wrapper around C PyImport_AddModule, which looks up an existing module

pyModule_GetDict :: PyObject -> IO PyObjectSource

Gets the dict associated with a module.