Martin v. Löwis <mar...@v.loewis.de> added the comment:

> issue9783.diff provides a patch that will compile clean on 32 and 64
> bit Windows systems.  I tried to avoid explicit casts where I could,
> but it was not always possible. I have ported a lot of my company's
> code to 64 bit (all Windows based).  In my experience many warnings
> are because of programmers using the int type in places where a
> size_t may be more appropriate. Most of the warnings here are due to
> mixing int and Py_ssize_t types.

I think the patch is incorrect as it stands: the casts may cause
truncation. As you say, int is still being used where size_t was
more appropriate, so I think we should change it in that manner
(e.g. make element_resize accept Py_ssize_t).

In cases where we really can't propagate Py_ssize_t to (e.g.
XML_Parse), we need to check for an int overflow, and raise
an exception if it does overflow.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9783>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to