On May 29, 2006, at 8:00 PM, Tim Peters wrote:

> [Bob Ippolito]
>>> ...
>>> Actually, should this be a FutureWarning or a DeprecationWarning?
>
> Since it was never documented, UndocumentedBugGoingAwayError ;-)
> Short of that, yes, DeprecationWarning.  FutureWarning is for changes
> in non-exceptional behavior (.e.g, if we swapped the meanings of "<"
> and ">" in struct format codes, that would rate a FutureWarning
> subclass, line InsaneFutureWarning).
>
>> OK, this behavior is implemented in revision 46537:
>>
>> (this is from ./python.exe -Wall)
>>
>>  >>> import struct
>
> ...
>
>>  >>> struct.pack('<B', -1)
>> /Users/bob/src/python/Lib/struct.py:63: DeprecationWarning: struct
>> integer wrapping is deprecated
>>    return o.pack(*args)
>> /Users/bob/src/python/Lib/struct.py:63: DeprecationWarning: 'B'
>> format requires 0 <= number <= 255
>>    return o.pack(*args)
>> '\xff'
>
> We certainly don't want to see two deprecation warnings for a single
> deprecated behavior.  I suggest eliminating the "struct integer
> wrapping" warning, mostly because I had no idea what it _meant_
> before reading the comments in _struct.c  ("wrapping" is used most
> often in a proxy or delegation context in Python these days).   "'B'
> format requires 0 <= number <= 255" is perfectly clear all by itself.

What should it be called instead of wrapping? When it says it's  
wrapping, it means that it's doing x &= (2 ^ (8 * n)) - 1 to force a  
number into meeting the expected range.

Reducing it to one warning instead of two is kinda difficult. Is it  
worth the trouble?

-bob

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to