[ python-Bugs-1077862 ] assert fail to threw exception when run python with '-O'

SourceForge.net noreply at sourceforge.net
Thu Dec 2 21:07:15 CET 2004


Bugs item #1077862, was opened at 2004-12-02 15:02
Message generated for change (Comment added) made by tim_one
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1077862&group_id=5470

Category: Python Interpreter Core
>Group: Not a Bug
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: tj128 (tj128)
Assigned to: Nobody/Anonymous (nobody)
Summary: assert fail to threw exception when run python with '-O'

Initial Comment:
in both 2.3 and 2.4 version, if you run 'python -O', 
assert fail to threw excetption when it should.

example

>python -O
Python 2.3.3 (#4, Apr 11 2004, 12:01:37) 
[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-20)] on linux2
Type "help", "copyright", "credits" or "license" for more 
information.
>>> try:
...  assert(1==2)
...  print 'yyy'
... except:
...  print 'zzz'
... 
yyy
>>> 


----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2004-12-02 15:07

Message:
Logged In: YES 
user_id=31435

That's correct, but it's a deliberate and documented feature.  
Please read the docs for the assert statement:

http://docs.python.org/ref/assert.html


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1077862&group_id=5470


More information about the Python-bugs-list mailing list