test_support27.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:deb-python-functools32 作者: openstack 项目源码 文件源码
def gc_collect():
    """Force as many objects as possible to be collected.

    In non-CPython implementations of Python, this is needed because timely
    deallocation is not guaranteed by the garbage collector.  (Even in CPython
    this can be the case in case of reference cycles.)  This means that __del__
    methods may be called later than expected and weakrefs may remain alive for
    longer than expected.  This function tries its best to force all garbage
    objects to disappear.
    """
    gc.collect()
    if is_jython:
        time.sleep(0.1)
    gc.collect()
    gc.collect()


#=======================================================================
# Decorator for running a function in a different locale, correctly resetting
# it afterwards.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号