[Python-Dev] Making sys.py3k_warning writable

Benjamin Peterson musiccomposition at gmail.com
Mon Mar 24 00:35:57 CET 2008


On Sun, Mar 23, 2008 at 6:21 PM, <skip at pobox.com> wrote:

>
> So, regarding -3 warnings in the 2.6 test code, should they be fixed or
> not?

I think we should introduce a decorator and/or a context manager in
test_support like this:
def silence_py3k(func):
    def decorator(*args, **kwargs):
       sys.disablepy3kwarning()
       func(*args, **kwargs)
       sys.enablepy3kwarning()
    return decorator
Of course, this depends on my patch in issue 2458. I think we could also do
it with warnings.simplefilter.

>
>
> Skip
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/musiccomposition%40gmail.com
>



-- 
Cheers,
Benjamin Peterson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20080323/e3f331a4/attachment.htm 


More information about the Python-Dev mailing list