[Python-Dev] Making sys.py3k_warning writable

Benjamin Peterson musiccomposition at gmail.com
Sat Mar 22 21:38:39 CET 2008


On Sat, Mar 22, 2008 at 3:34 PM, Steven Bethard <steven.bethard at gmail.com>
wrote:

> Right now, test_py3kwarn only runs if the test suite is run using the
> -3 command line flag to Python. So for most regrtest runs (e.g. the
> buildbots) this test will never be run.
>
>  It would be nice to be able to turn the flag on from Python (e.g.
> within test_py3kwarn). Is that possible?  Here's what I tried and it
> didn't seem to work::

That's because sys.py3kwarning is set on startup from Py_Py3kWarningFlag and
never checked again. Either we should make it immutable or fix it.

>
>
> $ python_d.exe
> Python 2.6a1+ (trunk:61715M, Mar 21 2008, 14:33:00) [MSC v.1500 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sys; sys.py3k_warning = True; callable(int)
> True
>
> And here's what happens when you specify -3 at the command line:
>
> $ python_d.exe -3
> Python 2.6a1+ (trunk:61715M, Mar 21 2008, 14:33:00) [MSC v.1500 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> callable(int)
> __main__:1: DeprecationWarning: callable() not supported in 3.x. Use
> hasattr(o, '__call__').
> True
>
> Steve
> --
> I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
> tiny blip on the distant coast of sanity.
>  --- Bucky Katt, Get Fuzzy
> _______________________________________________
> 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/20080322/5c1c9908/attachment.htm 


More information about the Python-Dev mailing list