[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Modules cPickle.c,2.52,2.53
Neil Schemenauer
nas@arctrix.com
Wed, 4 Oct 2000 02:46:36 -0700
On Wed, Oct 04, 2000 at 09:22:31AM -0700, Neil Schemenauer wrote:
> Update of /cvsroot/python/python/dist/src/Modules
> In directory slayer.i.sourceforge.net:/tmp/cvs-serv16887/Modules
>
> Modified Files:
> cPickle.c
> Log Message:
> - Fix a GC bug caused by PyDict_New() failing.
>
>
> Index: cPickle.c
> ===================================================================
> RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v
> retrieving revision 2.52
> retrieving revision 2.53
> diff -C2 -r2.52 -r2.53
> *** cPickle.c 2000/09/07 14:35:37 2.52
> --- cPickle.c 2000/10/04 16:22:26 2.53
> ***************
> *** 2876,2880 ****
> Py_INCREF(cls);
> UNLESS (inst->in_dict=PyDict_New()) {
> ! Py_DECREF(inst);
> goto err;
> }
> --- 2876,2881 ----
> Py_INCREF(cls);
> UNLESS (inst->in_dict=PyDict_New()) {
> ! inst = (PyInstanceObject *) PyObject_AS_GC(inst);
> ! PyObject_DEL(inst);
> goto err;
> }
I aways seem to think harder when reviewing a commit message than
a diff. :( I just realized that this commit subtly modifies
cPickle's behavior. Before the change instances __del__ methods
would be called if allocating __dict__ failed. After the change
they are not. I think the new behavior is better but the
question is will it break existing code? I think probably not.
BTW, pickle seems to follow the new behavior.
Neil