gen_test.py 文件源码

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

项目:ProgrameFacil 作者: Gpzim98 项目源码 文件源码
def test_gc(self):
        """Runners shouldn't GC if future is alive"""
        # Create the weakref
        weakref_scope = [None]
        def callback():
            gc.collect(2)
            weakref_scope[0]().set_result(123)

        @gen.coroutine
        def tester():
            fut = Future()
            weakref_scope[0] = weakref.ref(fut)
            self.io_loop.add_callback(callback)
            yield fut

        yield gen.with_timeout(
            datetime.timedelta(seconds=0.2),
            tester()
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号