Mark Dickinson <dicki...@gmail.com> added the comment:

Thanks for the patch.  I agree that undefined behaviour (e.g., from signed 
overflow) should be avoided where at all possible.

Do you have any Python examples that failed to trigger the overflow on your 
platform?  If so, it would be useful to add them to Lib/test/test_audioop.py as 
extra testcases.

One other question:  is there something about the formats that audioop is 
dealing with that limits sizes to INT_MAX (rather than PY_SSIZE_T_MAX, for 
example)?  I'm not really familiar with audio formats.

As an aside, I also find it strange that the code raises MemoryError in these 
cases, since these exceptions can be raised even when there's plenty of memory 
available.  IMO MemoryError should only be raised as a result of a failed 
attempt to allocate memory from the system.  Some other exception---perhaps 
OverflowError---would seem more appropriate here.

----------
nosy: +mark.dickinson

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

Reply via email to