Kaydet (Commit) 52716c94 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Let marshal built-up sets and frozensets one element at a time (without creating…

Let marshal built-up sets and frozensets one element at a time (without creating an intermediate tuple).
üst ecdcb589
......@@ -860,7 +860,7 @@ r_object(RFILE *p)
retval = NULL;
break;
}
v = PyTuple_New((int)n);
v = (type == TYPE_SET) ? PySet_New(NULL) : PyFrozenSet_New(NULL);
if (v == NULL) {
retval = NULL;
break;
......@@ -875,18 +875,14 @@ r_object(RFILE *p)
v = NULL;
break;
}
PyTuple_SET_ITEM(v, (int)i, v2);
if (PySet_Add(v, v2) == -1) {
Py_DECREF(v);
Py_DECREF(v2);
v = NULL;
break;
}
}
if (v == NULL) {
retval = NULL;
break;
}
if (type == TYPE_SET)
v3 = PySet_New(v);
else
v3 = PyFrozenSet_New(v);
Py_DECREF(v);
retval = v3;
retval = (v == NULL) ? NULL : v;
break;
case TYPE_CODE:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment