Commit 0567421a authored by Kevin Modzelewski's avatar Kevin Modzelewski

The _struct module caches things internally

parent c483a729
......@@ -1819,6 +1819,7 @@ cache_struct(PyObject *fmt)
cache = PyDict_New();
if (cache == NULL)
return NULL;
PyGC_RegisterStaticConstant(cache);
}
s_object = PyDict_GetItem(cache, fmt);
......@@ -1844,6 +1845,9 @@ PyDoc_STRVAR(clearcache_doc,
static PyObject *
clearcache(PyObject *self)
{
// `cache` is already registered as a static root; we would need to unregister it.
Py_FatalError("_struct.clearcache dosen't currently work well with Pyston");
abort();
Py_CLEAR(cache);
Py_RETURN_NONE;
}
......
# expected: reffail
import gzip
import io
......
# expected: reffail
from StringIO import StringIO
import json
......
# expected: reffail
import struct
s = struct.pack("II", 1, 1234)
print repr(s)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment