[issue8379] if __debug__: has nonobvious behaviour when evaluating .pyo without -O

2010-04-12 Thread Timothy Fitz

Timothy Fitz  added the comment:

In this case bytecode isn't an optimization, it's a distribution choice (this 
bug reared it's ugly head in our closed-source downloadable client).

I think that implausible execution paths are still a bug. 

Running a .pyo without -O should be explicitly an error. For instance can we 
change python to reliably blow up at import time? Or implicitly run as if you 
added -O?

--
nosy: +Timothy.Fitz

___
Python tracker 
<http://bugs.python.org/issue8379>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8379] if __debug__: has nonobvious behaviour when evaluating .pyo without -O

2010-04-14 Thread Timothy Fitz

Timothy Fitz  added the comment:

Does that mean you agree that the behavior is a bug?

If we're agreed that the behavior is a bug, then it's just a matter of solving 
the implementation details. One suggestion is to compile in a __debug__ check 
at the top of every .pyo file, effectively prepending every file with "if 
__debug__ == True: raise AssertionError()". Another could be to add a header to 
the bytecode (clearly waiting for the next major release of Python).

We'll gladly contribute patches once a suitable implementation has been chosen.

--

___
Python tracker 
<http://bugs.python.org/issue8379>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com