yuja added a comment.

  >   >   I think the default tp_new clears the memory of the object, so it 
won't be uninitialized (maybe that's what you mean by "luckily", but I first 
thought your meant it would require luck for it to be set to 0).
  >   
  >   Interesting. tp_alloc is documented to initialize memory to zeros.
  >   
  >   https://docs.python.org/2/c-api/typeobj.html#c.PyTypeObject.tp_alloc
  >   
  >   So 
https://phab.mercurial-scm.org/rHGe57c532c3835f6b244f21815cafcce0df1d272ce was 
a moot?
  
  Nah, it crashed. Perhaps, `tp_new` and `tp_alloc` wouldn't be called by
  `PyObject_New()`, which is said that "fields not defined by the Python
  object header are not initialized."
  
  https://docs.python.org/2/c-api/allocation.html#c.PyObject_New
  
  In 
https://phab.mercurial-scm.org/rHGe57c532c3835f6b244f21815cafcce0df1d272ce^, 
`parsers.parse_index2(0, 0)` crashed but `parsers.index()`
  didn't if I fixed `Py_DECREF(self->data)` in `index_dealloc()`.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4118

To: martinvonz, #hg-reviewers
Cc: yuja, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to