Skip to content
2 changes: 1 addition & 1 deletion docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ to Python 2's ``str`` object) and several standard library modules.
``python-future`` supports only Python 2.7+ and Python 3.4+, whereas ``six``
supports all versions of Python from 2.4 onwards. (See
:ref:`supported-versions`.) If you must support older Python versions,
``six`` will be esssential for you. However, beware that maintaining
``six`` will be essential for you. However, beware that maintaining
single-source compatibility with older Python versions is ugly and `not
fun <http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/>`_.

Expand Down
2 changes: 1 addition & 1 deletion src/future/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
__license__ = 'MIT'
__copyright__ = 'Copyright 2013-2016 Python Charmers Pty Ltd'
__ver_major__ = 0
__ver_minor__ = 16
__ver_minor__ = 17
__ver_patch__ = 0
__ver_sub__ = ''
__version__ = "%d.%d.%d%s" % (__ver_major__, __ver_minor__,
Expand Down
24 changes: 12 additions & 12 deletions src/future/types/newbytes.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,24 +373,24 @@ def __ne__(self, other):
unorderable_err = 'unorderable types: bytes() and {0}'

def __lt__(self, other):
if not isbytes(other):
raise TypeError(self.unorderable_err.format(type(other)))
return super(newbytes, self).__lt__(other)
if isinstance(other, _builtin_bytes):
return super(newbytes, self).__lt__(other)
raise TypeError(self.unorderable_err.format(type(other)))

def __le__(self, other):
if not isbytes(other):
raise TypeError(self.unorderable_err.format(type(other)))
return super(newbytes, self).__le__(other)
if isinstance(other, _builtin_bytes):
return super(newbytes, self).__le__(other)
raise TypeError(self.unorderable_err.format(type(other)))

def __gt__(self, other):
if not isbytes(other):
raise TypeError(self.unorderable_err.format(type(other)))
return super(newbytes, self).__gt__(other)
if isinstance(other, _builtin_bytes):
return super(newbytes, self).__gt__(other)
raise TypeError(self.unorderable_err.format(type(other)))

def __ge__(self, other):
if not isbytes(other):
raise TypeError(self.unorderable_err.format(type(other)))
return super(newbytes, self).__ge__(other)
if isinstance(other, _builtin_bytes):
return super(newbytes, self).__ge__(other)
raise TypeError(self.unorderable_err.format(type(other)))

def __native__(self):
# We can't just feed a newbytes object into str(), because
Expand Down
28 changes: 16 additions & 12 deletions src/future/types/newstr.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,24 +302,28 @@ def __ne__(self, other):
unorderable_err = 'unorderable types: str() and {0}'

def __lt__(self, other):
if not istext(other):
raise TypeError(self.unorderable_err.format(type(other)))
return super(newstr, self).__lt__(other)
if (isinstance(other, unicode) or
isinstance(other, bytes) and not isnewbytes(other)):
return super(newstr, self).__lt__(other)
raise TypeError(self.unorderable_err.format(type(other)))

def __le__(self, other):
if not istext(other):
raise TypeError(self.unorderable_err.format(type(other)))
return super(newstr, self).__le__(other)
if (isinstance(other, unicode) or
isinstance(other, bytes) and not isnewbytes(other)):
return super(newstr, self).__le__(other)
raise TypeError(self.unorderable_err.format(type(other)))

def __gt__(self, other):
if not istext(other):
raise TypeError(self.unorderable_err.format(type(other)))
return super(newstr, self).__gt__(other)
if (isinstance(other, unicode) or
isinstance(other, bytes) and not isnewbytes(other)):
return super(newstr, self).__gt__(other)
raise TypeError(self.unorderable_err.format(type(other)))

def __ge__(self, other):
if not istext(other):
raise TypeError(self.unorderable_err.format(type(other)))
return super(newstr, self).__ge__(other)
if (isinstance(other, unicode) or
isinstance(other, bytes) and not isnewbytes(other)):
return super(newstr, self).__ge__(other)
raise TypeError(self.unorderable_err.format(type(other)))

def __getattribute__(self, name):
"""
Expand Down
4 changes: 0 additions & 4 deletions tests/test_future/test_str.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,6 @@ def test_cmp(self):
s > 3
with self.assertRaises(TypeError):
s < 1000
with self.assertRaises(TypeError):
s > b'XYZ'
with self.assertRaises(TypeError):
s < b'XYZ'
with self.assertRaises(TypeError):
s <= 3
with self.assertRaises(TypeError):
Expand Down