Martin Panter added the comment:

Inspired by Issue 27473, I did a quick and dirty scan for obvious places that 
expect overflow to wrap, and found the following, which I think should be fixed:

Modules/_ctypes/_ctypes.c:1388, in PyCArrayType_new()
Objects/listobject.c:492, in list_concat()
Objects/tupleobject.c:457, in tupleconcat()
Objects/listobject.c:845, in listextend()

Also I played with enabling GCC’s -ftrapv option. Attached is a patch with 
three changes:

1. configure --with-pydebug enables -ftrapv (experimental, not sure everyone 
would want this)

2. Easy fix for negation overflow in audioop (I am happy to apply this part)

3. Avoid dumb overflows at end of for loop in Element Tree code when handling 
slices with step=sys.maxsize. Technically the overflow is undefined behaviour, 
but the change is annoying, because ignoring the overflow at the end of the 
loop is much simpler than adding special cases. Not sure what I think about 
this part.

----------
dependencies: +test_time fails: strftime('%Y', y) for negative year
nosy: +martin.panter
Added file: http://bugs.python.org/file43728/trapv.patch

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

Reply via email to