[PyQt] Re: Patch to add a "/Deprecated/" annotation to SIP

Phil Thompson phil at riverbankcomputing.co.uk
Sat Sep 20 14:18:38 BST 2008


On Fri, 19 Sep 2008 20:39:07 +0200, Giovanni Bajo <rasky at develer.com>
wrote:
> Hi Phil,
> 
> this patch to SIP adds a "/Deprecated/" annotation that can be used to
> mark functions that are deprecated. It causes a DeprecationWarning to be
> raised at runtime whenever the function is invoked.
> 
> Once a package correctly uses /Deprecated/, the users of the package can
> disable the warning (if they find it annoying) using the standard Python
> warning filter machinery (eg: it allows to disable warnings by matching
> the module name with a regexp). So I don't see a need to provide an
> alternative way to compile it on/off (eg: as SIP command line argument),
> nor at runtime.
> 
> This will be used by an upcoming PyQt3Support release that will mark all
> PyQt3 classes and methods as deprecated, to allow developers to quickly
> identify spots where Qt3Support is still in use.
> 
> The patch has been written by Lorenzo Berni (I'm submitting it on his
> behalf).

Applied - with a few changes...

You can also apply the annotation to a class so that all its sub-classes,
ctors and methods get deprecated.

I've improved the messages generated.

Thanks,
Phil



More information about the PyQt mailing list