Message249640
> If don't initialize fields, then they will be not initialized in odict_dealloc
Old code initialized all fields to zero (or NULL), like "_odict_FIRST(od) = NULL;". The type allocator fills the newly allocated with zeros. So setting fields again to zero is redundant (useless).
> I would allocate a dict for od_inst_dict before calling PyDict_Type.tp_new. An allocator can release GIL and call Python code, and at that moment the OrderedDict object is in inconsistent state.
Yes, but the newly created object is not still private at this point, there is only one reference known in the C code. dict_new() has the same design. You can please elaborate the issue?
We only give the reference to the caller when the newly created OrderedDict is fully initialized (consistent). |
|
Date |
User |
Action |
Args |
2015-09-03 14:03:54 | vstinner | set | recipients:
+ vstinner, rhettinger, eric.snow, serhiy.storchaka |
2015-09-03 14:03:54 | vstinner | set | messageid: <1441289034.87.0.559016889822.issue24992@psf.upfronthosting.co.za> |
2015-09-03 14:03:54 | vstinner | link | issue24992 messages |
2015-09-03 14:03:54 | vstinner | create | |
|