コード例 #1
0
ファイル: gc.py プロジェクト: kived/py-cnotify
def protect (self, object):
    """
    Protect C{object} from being garbage-collected.  It is legal to protect same C{object}
    several times and an object is prevented from being garbage-collected if it has been
    protected at least once.  As a special case, if C{object} is C{None}, this function
    does nothing.

    For convenience, this function always returns C{object} itself.

    @rtype: C{object}
    """

    raise_not_implemented_exception (self)
コード例 #2
0
ファイル: gc.py プロジェクト: kived/py-cnotify
def unprotect (self, object):
    """
    Unprotect C{object}.  If has been protected once only or exactly one time more than
    times it has been unprotected, make it a legal target for garbage collection again.
    It is an error to call C{unprotect} more times than C{protect} for a same object, and
    descendant behaviour in this case is undefined.  It may even crash Python.  However,
    as a special case, if C{object} is C{None}, this function does nothing.  In
    particular, it is legal to ‘unprotect’ C{None} without having protected it first,
    because it will be a no-op and not lead to bugs.

    For convenience, this function always returns C{object} itself.

    @rtype: C{object}
    """

    raise_not_implemented_exception (self)