[Zope-dev] Re: [Checkins] SVN: zope.deprecation/trunk/ Fix zope.deprecation.tests.warn() to have an identical signature to

Martijn Faassen faassen at startifact.com
Fri Jun 27 11:20:46 EDT 2008


Benji York wrote:
> On Fri, Jun 27, 2008 at 10:02 AM, Jan-Wijbrand Kolman
> <janwijbrand at gmail.com> wrote:
>> Log message for revision 87829:
>>  Fix zope.deprecation.tests.warn() to have an identical signature to
>>  warnings.warn() [snip]
> 
>> Modified: zope.deprecation/trunk/src/zope/deprecation/tests.py
>> ===================================================================
>> --- zope.deprecation/trunk/src/zope/deprecation/tests.py        2008-06-27 13:38:04 UTC (rev 87828)
>> +++ zope.deprecation/trunk/src/zope/deprecation/tests.py        2008-06-27 14:02:49 UTC (rev 87829)
>> @@ -43,12 +43,15 @@
>>     """Demonstrate that deprecate() also works in a local scope."""
>>     deprecated('demo4', 'demo4 is no more.')
>>
>> -def warn(message, type_, stacklevel):
>> +def warn(message, category=None, stacklevel=1):
> 
> Of course, if anyone is using keyword arguments to specify type_, then
> their code will break.  I don't think this is worth worrying about, but
> wanted to point out that it is ever-so-slightly backward incompatible.

The idea of 'zope.deprecation.tests.warn' is to replace warnings.warn 
for testing purposes, as far as I understand. Now warnings.warn in 
Python 2.4 and Python 2.5 has the signature with 'category', not 'type_' 
If someone was using type_ explicitly in the past, their code couldn't 
have worked properly during normal run-time. I'd therefore say this is a 
bug fix - if someone's tests because they used type_ before, they have a 
real problem.

Regards,

Martijn



More information about the Zope-Dev mailing list