Apologies for the delay. I had a bit of time today to look at this but the past few months have been VERY busy.
The optimize flag is left untouched in the base executables which is why __debug__ is True. BUT, when the code is compiled into bytecode, the optimize flag is indeed turned on which is why the assertion error is not raised. I agree this can be confusing. :-) That said, I've never run into a problem and the only solution that I can think of is to have 3 base executables for each of the current ones I have. In other words Console, ConsoleOptimize1 and ConsoleOptimize2 -- unless you can think of some clever way for the flag to be set? Anthony On Fri, Jan 23, 2009 at 4:52 AM, Eric Brunel <[email protected]> wrote: > Hi again, > > Continuing my tests, I've seen something strange concerning the > __debug__ variable in generated executables when using the optimize > flags. Here is the problem: I have a very simple script: > --test.py-------------------------- > print __debug__ > assert False > ------------------------------------- > > Interactively, it does what's expected: > $ python test.py > True > Traceback (most recent call last): > File "test.py", line 2, in <module> > assert False > AssertionError > > $ python -O test.py > False > > If built without any -O option, the result is the same as running it > interactively without the -O option. The surprise is when I build it > with -O1. The result is: > $ ./test > True > > So it seems the assert is actually removed from the final code, but > the __debug__ variable stays True. How is this possible? > -- > - Eric Brunel > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > cx-freeze-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/cx-freeze-users > ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ cx-freeze-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cx-freeze-users
