cpython-3.5.1: Bindings for libpython
Safe HaskellNone
LanguageHaskell2010

CPython.Types.WeakReference

Synopsis

Documentation

data Proxy Source #

Instances

Instances details
Object Proxy Source # 
Instance details

Defined in CPython.Types.WeakReference

newReference :: (Object obj, Object callback) => obj -> Maybe callback -> IO Reference Source #

Return a weak reference for the object. This will always return a new reference, but is not guaranteed to create a new object; an existing reference object may be returned. The second parameter, callback, can be a callable object that receives notification when obj is garbage collected; it should accept a single parameter, which will be the weak reference object itself. If ob is not a weakly-referencable object, or if callback is not callable, this will throw a TypeError.

newProxy :: (Object obj, Object callback) => obj -> Maybe callback -> IO Proxy Source #

Return a weak reference proxy for the object. This will always return a new reference, but is not guaranteed to create a new object; an existing proxy may be returned. The second parameter, callback, can be a callable object that receives notification when obj is garbage collected; it should accept a single parameter, which will be the weak reference object itself. If ob is not a weakly-referencable object, or if callback is not callable, this will throw a TypeError.

getObject :: Reference -> IO SomeObject Source #

Return the referenced object from a weak reference. If the referent is no longer live, returns None.