From cf56246de3d1026f5e2aeb851cd6fb66f81f48f6 Mon Sep 17 00:00:00 2001 From: Ed Schofield Date: Tue, 13 Dec 2016 14:20:11 +1100 Subject: [PATCH 1/7] Bump version number to 0.17.0-dev --- src/future/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/future/__init__.py b/src/future/__init__.py index 8139aa33..e1b7fe08 100644 --- a/src/future/__init__.py +++ b/src/future/__init__.py @@ -86,8 +86,8 @@ __license__ = 'MIT' __copyright__ = 'Copyright 2013-2016 Python Charmers Pty Ltd' __ver_major__ = 0 -__ver_minor__ = 16 +__ver_minor__ = 17 __ver_patch__ = 0 -__ver_sub__ = '' +__ver_sub__ = '-dev' __version__ = "%d.%d.%d%s" % (__ver_major__, __ver_minor__, __ver_patch__, __ver_sub__) From ad654c5ec0de7d5ff0a475a66de3c778606306b5 Mon Sep 17 00:00:00 2001 From: Ed Schofield Date: Tue, 13 Dec 2016 15:02:04 +1100 Subject: [PATCH 2/7] Add Py3.5 to Travis-CI tests --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 6e20573f..da167c1a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: python python: + - "3.5" - "3.4" - "3.3" - "2.7" From 2093a6b46875694b4b4de807fdca2c6994ba4838 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Sun, 8 Jan 2017 11:08:37 +0100 Subject: [PATCH 3/7] fix typo --- docs/faq.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/faq.rst b/docs/faq.rst index 57fef25e..edd27c94 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -220,7 +220,7 @@ to Python 2's ``str`` object) and several standard library modules. ``python-future`` supports only Python 2.6+ and Python 3.3+, 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 `_. From 9b51ec531198b8ee0b805c3526b02bb3bc57130d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89loi=20Rivard?= Date: Tue, 7 Mar 2017 09:38:32 +0100 Subject: [PATCH 4/7] Allow inequalities with newstr and newbytes. --- src/future/types/newbytes.py | 24 ++++++++++++------------ src/future/types/newstr.py | 28 ++++++++++++++++------------ tests/test_future/test_str.py | 4 ---- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/future/types/newbytes.py b/src/future/types/newbytes.py index 85e6501c..24ff5f90 100644 --- a/src/future/types/newbytes.py +++ b/src/future/types/newbytes.py @@ -348,24 +348,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 diff --git a/src/future/types/newstr.py b/src/future/types/newstr.py index fd8615af..7bb1d915 100644 --- a/src/future/types/newstr.py +++ b/src/future/types/newstr.py @@ -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): """ diff --git a/tests/test_future/test_str.py b/tests/test_future/test_str.py index 7e37a62f..d8da4d0e 100644 --- a/tests/test_future/test_str.py +++ b/tests/test_future/test_str.py @@ -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): From 1cf58c31cceb26f11b8fcfcfd188fd817ce95a94 Mon Sep 17 00:00:00 2001 From: cclauss Date: Sat, 19 Aug 2017 00:22:14 +0200 Subject: [PATCH 5/7] remove the parens on the cmp lambda definition See #297 Before this change, the code in question generates a SyntaxError in Python 3 --- docs/compatible_idioms.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/compatible_idioms.rst b/docs/compatible_idioms.rst index e48ac6d1..7eb0cfb6 100644 --- a/docs/compatible_idioms.rst +++ b/docs/compatible_idioms.rst @@ -1120,7 +1120,7 @@ cmp() .. code:: python # Python 2 and 3: alternative 2 - cmp = lambda(x, y): (x > y) - (x < y) + cmp = lambda x, y: (x > y) - (x < y) assert cmp('a', 'b') < 0 and cmp('b', 'a') > 0 and cmp('c', 'c') == 0 reload() ~~~~~~~~ From a6afa49318533390062035e19b790d54d89531d0 Mon Sep 17 00:00:00 2001 From: "Jordan M. Adler" Date: Mon, 10 Sep 2018 12:05:10 -0700 Subject: [PATCH 6/7] Revert "remove the parens from the cmp() lambda definition" --- docs/compatible_idioms.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/compatible_idioms.rst b/docs/compatible_idioms.rst index 7eb0cfb6..e48ac6d1 100644 --- a/docs/compatible_idioms.rst +++ b/docs/compatible_idioms.rst @@ -1120,7 +1120,7 @@ cmp() .. code:: python # Python 2 and 3: alternative 2 - cmp = lambda x, y: (x > y) - (x < y) + cmp = lambda(x, y): (x > y) - (x < y) assert cmp('a', 'b') < 0 and cmp('b', 'a') > 0 and cmp('c', 'c') == 0 reload() ~~~~~~~~ From 0d12a9ffac4fc929c940e3a3d10e980b1314ce8e Mon Sep 17 00:00:00 2001 From: Jordan Adler Date: Fri, 19 Oct 2018 15:42:48 -0700 Subject: [PATCH 7/7] drop -dev suffix --- src/future/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/future/__init__.py b/src/future/__init__.py index e1b7fe08..aee268a9 100644 --- a/src/future/__init__.py +++ b/src/future/__init__.py @@ -88,6 +88,6 @@ __ver_major__ = 0 __ver_minor__ = 17 __ver_patch__ = 0 -__ver_sub__ = '-dev' +__ver_sub__ = '' __version__ = "%d.%d.%d%s" % (__ver_major__, __ver_minor__, __ver_patch__, __ver_sub__)