~ubuntu-branches/ubuntu/precise/python3.2/precise

« back to all changes in this revision

Viewing changes to Modules/_pickle.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2011-02-14 16:12:14 UTC
  • mfrom: (10.1.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20110214161214-f5vwa226kebccmt9
Tags: 3.2~rc3-1
Python 3.2 release candidate 3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2244
2244
    if (len != 0) {
2245
2245
        /* Materialize the list elements. */
2246
2246
        if (PyList_CheckExact(obj) && self->proto > 0) {
2247
 
            if (Py_EnterRecursiveCall(" while pickling an object") == 0) {
2248
 
                status = batch_list_exact(self, obj);
2249
 
                Py_LeaveRecursiveCall();
2250
 
            }
 
2247
            if (Py_EnterRecursiveCall(" while pickling an object"))
 
2248
                goto error;
 
2249
            status = batch_list_exact(self, obj);
 
2250
            Py_LeaveRecursiveCall();
2251
2251
        } else {
2252
2252
            PyObject *iter = PyObject_GetIter(obj);
2253
2253
            if (iter == NULL)
2254
2254
                goto error;
2255
2255
 
2256
 
            if (Py_EnterRecursiveCall(" while pickling an object") == 0) {
2257
 
                status = batch_list(self, iter);
2258
 
                Py_LeaveRecursiveCall();
 
2256
            if (Py_EnterRecursiveCall(" while pickling an object")) {
 
2257
                Py_DECREF(iter);
 
2258
                goto error;
2259
2259
            }
 
2260
            status = batch_list(self, iter);
 
2261
            Py_LeaveRecursiveCall();
2260
2262
            Py_DECREF(iter);
2261
2263
        }
2262
2264
    }
2504
2506
        if (PyDict_CheckExact(obj) && self->proto > 0) {
2505
2507
            /* We can take certain shortcuts if we know this is a dict and
2506
2508
               not a dict subclass. */
2507
 
            if (Py_EnterRecursiveCall(" while pickling an object") == 0) {
2508
 
                status = batch_dict_exact(self, obj);
2509
 
                Py_LeaveRecursiveCall();
2510
 
            }
 
2509
            if (Py_EnterRecursiveCall(" while pickling an object"))
 
2510
                goto error;
 
2511
            status = batch_dict_exact(self, obj);
 
2512
            Py_LeaveRecursiveCall();
2511
2513
        } else {
2512
2514
            items = PyObject_CallMethod(obj, "items", "()");
2513
2515
            if (items == NULL)
2516
2518
            Py_DECREF(items);
2517
2519
            if (iter == NULL)
2518
2520
                goto error;
 
2521
            if (Py_EnterRecursiveCall(" while pickling an object")) {
 
2522
                Py_DECREF(iter);
 
2523
                goto error;
 
2524
            }
2519
2525
            status = batch_dict(self, iter);
 
2526
            Py_LeaveRecursiveCall();
2520
2527
            Py_DECREF(iter);
2521
2528
        }
2522
2529
    }
3044
3051
    PyObject *reduce_value = NULL;
3045
3052
    int status = 0;
3046
3053
 
3047
 
    if (Py_EnterRecursiveCall(" while pickling an object") < 0)
 
3054
    if (Py_EnterRecursiveCall(" while pickling an object"))
3048
3055
        return -1;
3049
3056
 
3050
3057
    /* The extra pers_save argument is necessary to avoid calling save_pers()