test_typeobject.py 文件源码

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

项目:python-doublescript 作者: fdintino 项目源码 文件源码
def test_set_bases_mro_refcount(self):
        def normally_set_base():
            return a_factory(set_b_base=True)

        A_normal = normally_set_base()
        gc.collect()
        normal_ref_count = sys.getrefcount(A_normal.__mro__)

        def patch_set_base():
            A = a_factory()
            B = b_factory()
            type_set_bases(A, (B,))
            return A

        A_patch = patch_set_base()

        gc.collect()
        patch_ref_count = sys.getrefcount(A_patch.__mro__)
        self.assertEqual(normal_ref_count, patch_ref_count)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号