[Python-bugs-list] [ python-Bugs-762985 ] str.split seems to eat exception

SourceForge.net noreply@sourceforge.net
Sun, 29 Jun 2003 20:18:58 -0700


Bugs item #762985, was opened at 2003-06-30 05:18
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=762985&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 7
Submitted By: Gerhard Häring (ghaering)
Assigned to: Gerhard Häring (ghaering)
Summary: str.split seems to eat exception

Initial Comment:
comp.lang.python posting from Bill C. Wong (Message-ID:
<7sNLa.30264$Kg7.14786@nwrdny01.gnilink.net>)

################################
def func( s ):
    s1, s2 = s.split( ' ', 1 )
    try:
        raise s1
    except "aaaa":
        print 'except "aaaa"'
    except:
        print 'except:'

s = "aaaa "
func( s )
################################
If I manually assign s1 with s1 = "aaaa", then it works
fine! What am I doing wrong here?

----

Indeed if after the line s1, s2 = s.split you insert a line

s1 = "aaaaa"

then a different except clause is executed. Confirmed
with both Python 2.2.3 and Python 2.3beta2. This smells
like a bug to me.

Assigning to me and trying to investigate further.

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

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