[ python-Bugs-1086096 ] two strings holding the same value have different id

SourceForge.net noreply at sourceforge.net
Wed Dec 15 23:10:01 CET 2004


Bugs item #1086096, was opened at 2004-12-15 17:10
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=1086096&group_id=5470

Category: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Stefan Seefeld (stefan)
Assigned to: Nobody/Anonymous (nobody)
Summary: two strings holding the same value have different id

Initial Comment:
I'v run into a problem with a program that expects a string
to be either 'resource' or 'test':

type = ...

if type is "resource":
   do_something()
elif type is "test":
   do_something_else()


The above comparison using 'is' works fine with python 2.3,
but fails with python 2.4. Unfortunately I wasn't able to
isolate the problem. 

To reproduce:

Install qmtest from http://www.qmtest.com on windows xp
with python 2.4 (I don't know yet whether other platforms
are affected, too).
Then follow the instructions from
http://www.codesourcery.com/public/qmtest/qm-2.2/manual.html
up to section 2.2 'Starting the Graphical Interface'.
In the browser, click on the 'exec1' test, and you'll
get an
'UnboundLocalError' because the application logic didn't 
expect some comparison to fail.
The failed comparison in question is 't is "test"',
which returns 'False' even though t == "test".



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

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


More information about the Python-bugs-list mailing list