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.
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 @@
* 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 @@
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;