@@ -302,24 +302,28 @@ def __ne__(self, other):
302302 unorderable_err = 'unorderable types: str() and {0}'
303303
304304 def __lt__ (self , other ):
305- if not istext (other ):
306- raise TypeError (self .unorderable_err .format (type (other )))
307- return super (newstr , self ).__lt__ (other )
305+ if (isinstance (other , unicode ) or
306+ isinstance (other , bytes ) and not isnewbytes (other )):
307+ return super (newstr , self ).__lt__ (other )
308+ raise TypeError (self .unorderable_err .format (type (other )))
308309
309310 def __le__ (self , other ):
310- if not istext (other ):
311- raise TypeError (self .unorderable_err .format (type (other )))
312- return super (newstr , self ).__le__ (other )
311+ if (isinstance (other , unicode ) or
312+ isinstance (other , bytes ) and not isnewbytes (other )):
313+ return super (newstr , self ).__le__ (other )
314+ raise TypeError (self .unorderable_err .format (type (other )))
313315
314316 def __gt__ (self , other ):
315- if not istext (other ):
316- raise TypeError (self .unorderable_err .format (type (other )))
317- return super (newstr , self ).__gt__ (other )
317+ if (isinstance (other , unicode ) or
318+ isinstance (other , bytes ) and not isnewbytes (other )):
319+ return super (newstr , self ).__gt__ (other )
320+ raise TypeError (self .unorderable_err .format (type (other )))
318321
319322 def __ge__ (self , other ):
320- if not istext (other ):
321- raise TypeError (self .unorderable_err .format (type (other )))
322- return super (newstr , self ).__ge__ (other )
323+ if (isinstance (other , unicode ) or
324+ isinstance (other , bytes ) and not isnewbytes (other )):
325+ return super (newstr , self ).__ge__ (other )
326+ raise TypeError (self .unorderable_err .format (type (other )))
323327
324328 def __getattribute__ (self , name ):
325329 """
0 commit comments