diff options
author | INADA Naoki <inada-n@klab.com> | 2012-08-24 09:53:18 +0900 |
---|---|---|
committer | INADA Naoki <inada-n@klab.com> | 2012-08-24 09:53:18 +0900 |
commit | 235b928be7b43f1a5f1753ff08e685cbcf55bba4 (patch) | |
tree | da900dadc278395369320e728cec23c265967db6 | |
parent | 6aa4aead31e01e22f5297fadc7c3e4b0e90ba8ae (diff) | |
download | msgpack-python-235b928be7b43f1a5f1753ff08e685cbcf55bba4.tar.gz |
Stop disable/enable gc.
json and pickle modules don't stop gc. It's a very dirty hack.
-rw-r--r-- | msgpack/_msgpack.pyx | 12 |
1 files changed, 1 insertions, 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 = <PyObject*>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) |