From 235b928be7b43f1a5f1753ff08e685cbcf55bba4 Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Fri, 24 Aug 2012 09:53:18 +0900 Subject: [PATCH] Stop disable/enable gc. json and pickle modules don't stop gc. It's a very dirty hack. --- msgpack/_msgpack.pyx | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/msgpack/_msgpack.pyx b/msgpack/_msgpack.pyx index ebf1592..7ff0cff 100644 --- a/msgpack/_msgpack.pyx +++ b/msgpack/_msgpack.pyx @@ -13,10 +13,6 @@ from libc.string cimport * from libc.limits cimport * -import gc -_gc_disable = gc.disable -_gc_enable = gc.enable - cdef extern from "pack.h": struct msgpack_packer: char* buf @@ -242,11 +238,7 @@ def unpackb(object packed, object object_hook=None, object list_hook=None, if not PyCallable_Check(list_hook): raise TypeError("list_hook must be a callable.") ctx.user.list_hook = list_hook - _gc_disable() - try: - ret = template_execute(&ctx, buf, buf_len, &off) - finally: - _gc_enable() + ret = template_execute(&ctx, buf, buf_len, &off) if ret == 1: return template_data(&ctx) else: @@ -444,9 +436,7 @@ cdef class Unpacker(object): """unpack one object""" cdef int ret while 1: - _gc_disable() ret = template_execute(&self.ctx, self.buf, self.buf_tail, &self.buf_head) - _gc_enable() if ret == 1: o = template_data(&self.ctx) template_init(&self.ctx)