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::
$ 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
On Sat, Mar 22, 2008 at 3:34 PM, Steven Bethard steven.bethard@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@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/musiccomposition%40gmail.c...
On Sat, Mar 22, 2008 at 3:58 PM, "Martin v. Löwis" martin@v.loewis.de wrote:
Steven Bethard 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.
For the buildbots, it would be easy to turn -3 on, though.
Should I work a patch to allow Python code to disable/enable the flag?
Regards, Martin _______________________________________________ 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/musiccomposition%40gmail.c...
On Sat, Mar 22, 2008 at 4:08 PM, "Martin v. Löwis" martin@v.loewis.de wrote:
For the buildbots, it would be easy to turn -3 on, though.
Should I work a patch to allow Python code to disable/enable the flag?
+0.
See issue 2458.
Regards, Martin
On Sat, Mar 22, 2008 at 2:58 PM, "Martin v. Löwis" martin@v.loewis.de wrote:
Steven Bethard 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.
For the buildbots, it would be easy to turn -3 on, though.
Right now, running the test suite with -3 spews a load of warnings since there is a lot of code that hasn't been updated for even simple things like ``dict.has_key``.
Would turning the -3 flag on make it too hard to diagnose problems? If people don't think so, I'm happy to have it turned on. I did find a minor bug in the test suite when I turned it on and ran the full regrtest.
On Sat, Mar 22, 2008 at 3:29 PM, Benjamin Peterson musiccomposition@gmail.com wrote: [http://bugs.python.org/issue2458]
Thanks for putting that together!
Steve
>> Would turning the -3 flag on make it too hard to diagnose problems?
Martin> Yes. I don't think it should be turned on regularly in the tests Martin> until they regularly are quiet under -3.
Maybe regrtest should gain a -3 flag. All it would have to do is restart itself moving the -3 from after regrtest to before it.
Skip
skip> Maybe regrtest should gain a -3 flag. All it would have to do is skip> restart itself moving the -3 from after regrtest to before it.
Ehh... That didn't seem like such a great idea about 10 seconds after I hit send. Adding a test3 target to Makefile.pre.in is a lot easier.
Skip
On Sun, Mar 23, 2008 at 6:21 PM, skip@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@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/musiccomposition%40gmail.c...