[Python-checkins] python/dist/src/Modules cPickle.c,2.118,2.119
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Mon, 03 Feb 2003 16:21:10 -0800
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv2555/Modules
Modified Files:
cPickle.c
Log Message:
Brought some module variables into synch with pickle.py's current values.
Imported the extension-registry dicts from copy_reg.py, in preparation for
tackling EXT[124].
Index: cPickle.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v
retrieving revision 2.118
retrieving revision 2.119
diff -C2 -d -r2.118 -r2.119
*** cPickle.c 3 Feb 2003 22:07:24 -0000 2.118
--- cPickle.c 4 Feb 2003 00:21:07 -0000 2.119
***************
*** 96,102 ****
static PyObject *BadPickleGet;
static PyObject *dispatch_table;
! static PyObject *empty_tuple;
static PyObject *__class___str, *__getinitargs___str, *__dict___str,
--- 96,112 ----
static PyObject *BadPickleGet;
+ /* As the name says, an empty tuple. */
+ static PyObject *empty_tuple;
+ /* copy_reg.dispatch_table, {type_object: pickling_function} */
static PyObject *dispatch_table;
!
! /* For EXT[124] opcodes. */
! /* copy_reg.extension_registry, {(module_name, function_name): code} */
! static PyObject *extension_registry;
! /* copy_reg.inverted_registry, {code: (module_name, function_name)} */
! static PyObject *inverted_registry;
! /* copy_reg.extension_cache, {code: object} */
! static PyObject *extension_cache;
static PyObject *__class___str, *__getinitargs___str, *__dict___str,
***************
*** 2593,2605 ****
if (PyEval_GetRestricted()) {
/* Restricted execution, get private tables */
! PyObject *m;
! if (!( m=PyImport_Import(copy_reg_str))) goto err;
! self->dispatch_table=PyObject_GetAttr(m, dispatch_table_str);
Py_DECREF(m);
! if (!( self->dispatch_table )) goto err;
}
else {
! self->dispatch_table=dispatch_table;
Py_INCREF(dispatch_table);
}
--- 2603,2617 ----
if (PyEval_GetRestricted()) {
/* Restricted execution, get private tables */
! PyObject *m = PyImport_Import(copy_reg_str);
! if (m == NULL)
! goto err;
! self->dispatch_table = PyObject_GetAttr(m, dispatch_table_str);
Py_DECREF(m);
! if (self->dispatch_table == NULL)
! goto err;
}
else {
! self->dispatch_table = dispatch_table;
Py_INCREF(dispatch_table);
}
***************
*** 5078,5083 ****
one in restricted mode. */
dispatch_table = PyObject_GetAttr(copy_reg, dispatch_table_str);
! if (!dispatch_table)
! return -1;
Py_DECREF(copy_reg);
--- 5090,5106 ----
one in restricted mode. */
dispatch_table = PyObject_GetAttr(copy_reg, dispatch_table_str);
! if (!dispatch_table) return -1;
!
! extension_registry = PyObject_GetAttrString(copy_reg,
! "extension_registry");
! if (!extension_registry) return -1;
!
! inverted_registry = PyObject_GetAttrString(copy_reg,
! "inverted_registry");
! if (!inverted_registry) return -1;
!
! extension_cache = PyObject_GetAttrString(copy_reg,
! "extension_cache");
! if (!extension_cache) return -1;
Py_DECREF(copy_reg);
***************
*** 5169,5173 ****
PyObject *m, *d, *di, *v, *k;
int i;
! char *rev="1.71";
PyObject *format_version;
PyObject *compatible_formats;
--- 5192,5196 ----
PyObject *m, *d, *di, *v, *k;
int i;
! char *rev = "1.71"; /* XXX when does this change? */
PyObject *format_version;
PyObject *compatible_formats;
***************
*** 5178,5184 ****
/* Initialize some pieces. We need to do this before module creation,
! so we're forced to use a temporary dictionary. :(
! */
! di=PyDict_New();
if (!di) return;
if (init_stuff(di) < 0) return;
--- 5201,5207 ----
/* Initialize some pieces. We need to do this before module creation,
! * so we're forced to use a temporary dictionary. :(
! */
! di = PyDict_New();
if (!di) return;
if (init_stuff(di) < 0) return;
***************
*** 5191,5195 ****
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
! PyDict_SetItemString(d,"__version__", v = PyString_FromString(rev));
Py_XDECREF(v);
--- 5214,5219 ----
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
! v = PyString_FromString(rev);
! PyDict_SetItemString(d, "__version__", v);
Py_XDECREF(v);
***************
*** 5203,5209 ****
Py_DECREF(di);
! format_version = PyString_FromString("1.3");
! compatible_formats = Py_BuildValue("[sss]", "1.0", "1.1", "1.2");
!
PyDict_SetItemString(d, "format_version", format_version);
PyDict_SetItemString(d, "compatible_formats", compatible_formats);
--- 5227,5240 ----
Py_DECREF(di);
! /* These are purely informational; no code uses them. */
! /* File format version we write. */
! format_version = PyString_FromString("2.0");
! /* Format versions we can read. */
! compatible_formats = Py_BuildValue("[sssss]",
! "1.0", /* Original protocol 0 */
! "1.1", /* Protocol 0 + INST */
! "1.2", /* Original protocol 1 */
! "1.3", /* Protocol 1 + BINFLOAT */
! "2.0"); /* Oritinal potocol 2 */
PyDict_SetItemString(d, "format_version", format_version);
PyDict_SetItemString(d, "compatible_formats", compatible_formats);