module CPython.Types.Method
( Method
, methodType
, new
, function
, self
) where
import CPython.Internal hiding (new)
newtype Method = Method (ForeignPtr Method)
instance Object Method where
toObject (Method x) = SomeObject x
fromForeignPtr = Method
instance Concrete Method where
concreteType _ = methodType
methodType :: Type
methodType =
unsafePerformIO $
let {res = methodType'_} in
peekStaticObject res >>= \res' ->
return (res')
new :: (Object func, Object self) => func -> self -> IO (Method)
new a1 a2 =
withObject a1 $ \a1' ->
withObject a2 $ \a2' ->
new'_ a1' a2' >>= \res ->
stealObject res >>= \res' ->
return (res')
function :: Method -> IO (SomeObject)
function a1 =
withObject a1 $ \a1' ->
function'_ a1' >>= \res ->
peekObject res >>= \res' ->
return (res')
self :: Method -> IO (SomeObject)
self a1 =
withObject a1 $ \a1' ->
self'_ a1' >>= \res ->
peekObject res >>= \res' ->
return (res')
foreign import ccall unsafe "CPython/Types/Method.chs.h hscpython_PyMethod_Type"
methodType'_ :: (Ptr ())
foreign import ccall safe "CPython/Types/Method.chs.h PyMethod_New"
new'_ :: ((Ptr ()) -> ((Ptr ()) -> (IO (Ptr ()))))
foreign import ccall safe "CPython/Types/Method.chs.h PyMethod_Function"
function'_ :: ((Ptr ()) -> (IO (Ptr ())))
foreign import ccall safe "CPython/Types/Method.chs.h PyMethod_Self"
self'_ :: ((Ptr ()) -> (IO (Ptr ())))