If interning an instance of a string subclass, intern a real string object
with the same value instead.  This ensures that a string (or string
subclass) object's ob_sinterned pointer is always a str (or NULL), and
that the dict of interned strings only has strs as keys.
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 8d9e81e..b029979 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -1529,6 +1529,20 @@
     verify(s.lower().__class__ is str)
     verify(s.lower() == base)
 
+    s = madstring("x y")
+    verify(intern(s).__class__ is str)
+    verify(intern(s) is intern("x y"))
+    verify(intern(s) == "x y")
+
+    i = intern("y x")
+    s = madstring("y x")
+    verify(intern(s).__class__ is str)
+    verify(intern(s) is i)
+
+    s = madstring(i)
+    verify(intern(s).__class__ is str)
+    verify(intern(s) is i)
+
     class madunicode(unicode):
         _rev = None
         def rev(self):