[PATCH RFC] parser: use PyInt_FromSsize_t in index_stats

Antoine Pitrou solipsis at pitrou.net
Wed May 9 16:49:38 CDT 2012


On Wed, 09 May 2012 23:45:27 +0200
Adrian Buehlmann <adrian at cadifra.com> wrote:
> 
> > If PyInt_FromSsize_t fails, PyDict_SetItemString called with a
> > NULL value will probably segfault.
> > Now the only reason I can think of for PyInt_FromSsize_t to fail is a
> > MemoryError (same for PyInt_FromLong), so you might rightly argue it's
> > unlikely.
> 
> I might also argue that this isn't the scope of this patch and you could
> have mentioned that earlier, but that would probably be a bit too dense. :-)

Well I hardly read many patches on mercurial-devel. This one caught my
eye for some reason.

> I also take it that you are not opposed to my approach for addressing
> said warnings ("conversion from 'Py_ssize_t' to 'long', possible loss of
> data").

No, it's definitely the right approach for compatibility with 64-bit
Windows :)

Regards

Antoine.


More information about the Mercurial-devel mailing list