summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-10-12 04:11:06 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-10-12 04:11:06 (GMT)
commita0fb177be8d04a6c393cdf4078ce58bfa76bc26d (patch)
tree2785f7018fb64036dd9640575ebb2460284f5267 /Objects
parentfc57ccb98248b4a8f4ba4debdf3791970b136c4d (diff)
downloadcpython-a0fb177be8d04a6c393cdf4078ce58bfa76bc26d.zip
cpython-a0fb177be8d04a6c393cdf4078ce58bfa76bc26d.tar.gz
cpython-a0fb177be8d04a6c393cdf4078ce58bfa76bc26d.tar.bz2
Progress on SF bug #466175 and general cleanup.
Add a fast_container member to Picklerobject. If fast is true, then fast_container counts the depth of nested container calls. If the depth exceeds FAST_LIMIT (2000), the fast flag is ignored and the normal checks occur. This approach is much like the approach for prevent stack overflow for comparison and reprs of recursive objects (e.g. [[...]]). - Fast container used for save_list(), save_dict(), and save_inst(). XXX Not clear which other save_xxx() functions should use it. Make Picklerobject into new-style types, using PyObject_GenericGetAttr() and PyObject_GenericSetAttr(). - Use PyMemberDef for binary and fast members - Use PyGetSetDef for persistent_id, inst_persistent_id, memo, and PicklingError. XXX Not all of these seem like they need to use getset, but it's not clear why the old getattr() and setattr() had such odd semantics. One change is that the getvalue() attribute will exist on all Picklers, not just list-based picklers; I think this is a more rationale interface. There is a long laundry list of other changes: - Remove unused #defines for PyList_SET_ITEM() etc. - Make some of the indentation consistent - Replace uses of cPickle_PyMapping_HasKey() where the first argument is self->memo with calls to PyDict_GetItem(), because self->memo must be a dictionary. - Don't bother to check if cPickle_PyMapping_HasKey() returns < 0, because it can only return 0 or 1. - Replace uses of PyObject_CallObject() with PyObject_Call(), when we can guarantee that the argument tuple is really a tuple. Performance impacts of these changes: - 5% speedup for normal pickling - No change to fast-mode pickling. XXX Really need tests for all the features in cPickle that aren't in pickle.
Diffstat (limited to 'Objects')
0 files changed, 0 insertions, 0 deletions