[Python-checkins] python/dist/src/Modules cPickle.c,2.124,2.125
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Tue, 04 Feb 2003 13:47:53 -0800
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv31627/Modules
Modified Files:
cPickle.c
Log Message:
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.
Index: cPickle.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v
retrieving revision 2.124
retrieving revision 2.125
diff -C2 -d -r2.124 -r2.125
*** cPickle.c 4 Feb 2003 20:56:09 -0000 2.124
--- cPickle.c 4 Feb 2003 21:47:44 -0000 2.125
***************
*** 1947,1951 ****
*/
PyObject *py_code; /* extension code as Python object */
! long code; /* extensoin code as C value */
char c_str[5];
int n;
--- 1947,1951 ----
*/
PyObject *py_code; /* extension code as Python object */
! long code; /* extension code as C value */
char c_str[5];
int n;
***************
*** 5281,5284 ****
--- 5281,5289 ----
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 */