summaryrefslogtreecommitdiffstats
path: root/Modules/cPickle.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2003-02-04 21:47:44 (GMT)
committerTim Peters <tim.peters@gmail.com>2003-02-04 21:47:44 (GMT)
commit3e667d5452ce480eee2d4125c1209630e02ac574 (patch)
tree521455459e6c62ba4c07aa8d698ef2a6654eaa36 /Modules/cPickle.c
parent5042da6b1e567039951cdfe6b822dd725012bdf1 (diff)
downloadcpython-3e667d5452ce480eee2d4125c1209630e02ac574.zip
cpython-3e667d5452ce480eee2d4125c1209630e02ac574.tar.gz
cpython-3e667d5452ce480eee2d4125c1209630e02ac574.tar.bz2
cPickle: exempt two_tuple from GC -- it's a speed hack, and doesn't
guarantee to keep valid pointers in its slots. tests: Moved ExtensionSaver from test_copy_reg into pickletester, and use it both places. Once extension codes get assigned, it won't be safe to overwrite them willy nilly in test suites, and ExtensionSaver does a thorough job of undoing any possible damage. Beefed up the EXT[124] tests a bit, to check the smallest and largest codes in each opcode's range too.
Diffstat (limited to 'Modules/cPickle.c')
-rw-r--r--Modules/cPickle.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index c8b194b..e726220 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -1946,7 +1946,7 @@ save_global(Picklerobject *self, PyObject *args, PyObject *name)
* so generate an EXT opcode.
*/
PyObject *py_code; /* extension code as Python object */
- long code; /* extensoin code as C value */
+ long code; /* extension code as C value */
char c_str[5];
int n;
@@ -5280,6 +5280,11 @@ init_stuff(PyObject *module_dict)
two_tuple = PyTuple_New(2);
if (two_tuple == NULL)
return -1;
+ /* We use this temp container with no regard to refcounts, or to
+ * keeping containees alive. Exempt from GC, because we don't
+ * want anything looking at two_tuple() by magic.
+ */
+ PyObject_GC_UnTrack(two_tuple);
/* Ugh */
if (!( t=PyImport_ImportModule("__builtin__"))) return -1;