test_context.py 文件源码

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

项目:trex-http-proxy 作者: alwye 项目源码 文件源码
def test_cyclic_destroy(self):
        """ctx.destroy should succeed when cyclic ref prevents gc"""
        # test credit @dln (GH #137):
        class CyclicReference(object):
            def __init__(self, parent=None):
                self.parent = parent

            def crash(self, sock):
                self.sock = sock
                self.child = CyclicReference(self)

        def crash_zmq():
            ctx = self.Context()
            sock = ctx.socket(zmq.PULL)
            c = CyclicReference()
            c.crash(sock)
            ctx.destroy()

        crash_zmq()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号