ARGDECL(int, n)
{
PyObject *bytes, *str;
- char *ret_str;
UNLESS(bytes = PyInt_FromLong(n))
{
return NULL;
i = 0;
- while (j = PyDict_Next(modules_dict, &i, &name, &module))
+ while ((j = PyDict_Next(modules_dict, &i, &name, &module)))
{
UNLESS(name_str = PyString_AsString(name))
return NULL;
ARGDECL(Picklerobject *, self)
ARGDECL(PyObject *, args)
{
- PyObject *class = 0, *module = 0, *name = 0, *py_inst_id = 0, *init_args = 0,
+ PyObject *class = 0, *module = 0, *name = 0,
*junk = 0, *state = 0, *getinitargs_func = 0, *getstate_func = 0;
char *module_str, *name_str, *c_str;
- int len, p, module_size, name_size, size;
+ int module_size, name_size, size;
static char build = BUILD;
if ((*self->write_func)(self, &MARKv, 1) == -1)
Py_DECREF(junk);
}
- if (getinitargs_func = PyObject_GetAttrString(args, "__getinitargs__"))
+ if ((getinitargs_func = PyObject_GetAttrString(args, "__getinitargs__")))
{
PyObject *class_args = 0, *element = 0;
int i, len;
}
}
- if (getstate_func = PyObject_GetAttrString(args, "__getstate__"))
+ if ((getstate_func = PyObject_GetAttrString(args, "__getstate__")))
{
UNLESS(state = PyObject_CallObject(getstate_func, empty_tuple))
{
ARGDECL(PyObject *, args)
{
PyObject *py_string = 0;
- char *s, *endptr;
+ char *s;
int len, i;
if ((len = (*self->readline_func)(self, &s)) == -1)
Py_INCREF(Py_None);
return Py_None;
-
-err:
- Py_XDECREF(py_string);
-
- return NULL;
}
ARGDECL(PyObject *, args)
{
PyObject *arg_tup = 0, *arg_slice = 0, *class = 0, *obj = 0;
- int i, j, len;
+ int i, j;
char *s, *module_name, *class_name;
if ((i = marker(self)) == -1)
ARGDECL(PyObject *, args)
{
PyObject *stack = 0, *key = 0, *junk = 0, *err = 0,
- *exc = 0, *val = 0, *tb = 0, *str = 0,
- *key_repr = 0;
+ *val = 0, *str = 0, *key_repr = 0;
char c;
char *c_str;
int len;
return NULL;
sprintf(PyString_AS_STRING((PyStringObject *)str),
- "invalid load key, \%s\.", PyString_AS_STRING((PyStringObject *)key_repr));
+ "invalid load key, \%s.", PyString_AS_STRING((PyStringObject *)key_repr));
PyErr_SetObject(UnpicklingError, str);
PyObject *builtins, *apply_func, *string;
UNLESS(builtins = PyImport_ImportModule("__builtin__"))
- return NULL;
+ return 1;
UNLESS(apply_func = PyObject_GetAttrString(builtins, "apply"))
- return NULL;
+ return 1;
BuiltinFunctionType = apply_func->ob_type;
Py_DECREF(builtins);
UNLESS(string = PyImport_ImportModule("string"))
- return NULL;
+ return 1;
UNLESS(atol_func = PyObject_GetAttrString(string, "atol"))
- return NULL;
+ return 1;
Py_DECREF(string);
UNLESS(empty_list = PyList_New(0))
- return NULL;
+ return 1;
UNLESS(empty_tuple = PyTuple_New(0))
- return NULL;
+ return 1;
UNLESS(class_map = PyDict_New())
- return NULL;
+ return 1;
UNLESS(PicklingError = PyString_FromString("cPickle.PicklingError"))
- return NULL;
+ return 1;
UNLESS(UnpicklingError = PyString_FromString("cPickle.UnpicklingError"))
- return NULL;
+ return 1;
PycString_IMPORT;
+ return 0;
}
/* XXXX Add constants here */
- init_stuff();
+ if (init_stuff())
+ Py_FatalError("can't initialize module cPickle");
+
CHECK_FOR_ERRORS("can't initialize module cPickle");
PyDict_SetItemString(d, "PicklingError", PicklingError);