From 8c3f214158c363fac06aa953d03db1ca23cd3c43 Mon Sep 17 00:00:00 2001 From: achapkowski Date: Wed, 29 May 2019 06:22:22 -0400 Subject: [PATCH 1/5] - Fix so older versions of typing are acknowledged other than python 3.7 --- cloudpickle/cloudpickle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudpickle/cloudpickle.py b/cloudpickle/cloudpickle.py index 1c91021e9..b2823afbc 100644 --- a/cloudpickle/cloudpickle.py +++ b/cloudpickle/cloudpickle.py @@ -657,7 +657,7 @@ def save_function_tuple(self, func): 'name': func.__name__, 'doc': func.__doc__, } - if hasattr(func, '__annotations__') and sys.version_info >= (3, 7): + if hasattr(func, '__annotations__') and sys.version_info >= (3, 4): state['annotations'] = func.__annotations__ if hasattr(func, '__qualname__'): state['qualname'] = func.__qualname__ From d92ce8ac08a464e900ed2db4a83381fdc4785335 Mon Sep 17 00:00:00 2001 From: achapkowski Date: Wed, 29 May 2019 08:03:26 -0400 Subject: [PATCH 2/5] - updated the test doc as requested. --- tests/cloudpickle_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cloudpickle_test.py b/tests/cloudpickle_test.py index 7f7d7dfd8..e0e60ad68 100644 --- a/tests/cloudpickle_test.py +++ b/tests/cloudpickle_test.py @@ -1588,7 +1588,7 @@ def g(): self.assertEqual(f2.__doc__, f.__doc__) - @unittest.skipIf(sys.version_info < (3, 7), + @unittest.skipIf(sys.version_info < (3, 4), """This syntax won't work on py2 and pickling annotations isn't supported for py36 and below.""") def test_wraps_preserves_function_annotations(self): From 7969ddb3b577d858244c0268e5f90dab55212ee0 Mon Sep 17 00:00:00 2001 From: achapkowski Date: Wed, 29 May 2019 08:12:28 -0400 Subject: [PATCH 3/5] fixed test comment. --- tests/cloudpickle_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cloudpickle_test.py b/tests/cloudpickle_test.py index e0e60ad68..59f083989 100644 --- a/tests/cloudpickle_test.py +++ b/tests/cloudpickle_test.py @@ -1590,7 +1590,7 @@ def g(): @unittest.skipIf(sys.version_info < (3, 4), """This syntax won't work on py2 and pickling annotations - isn't supported for py36 and below.""") + isn't supported for py34 and below.""") def test_wraps_preserves_function_annotations(self): from functools import wraps From 9b14a66bdbe23219af744e4be1717611afdd9bbe Mon Sep 17 00:00:00 2001 From: achapkowski Date: Wed, 29 May 2019 09:40:10 -0400 Subject: [PATCH 4/5] - Added to CHANGES.md --- CHANGES.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index f1e1cddd1..fdaa4e762 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,8 @@ - Support pickling of classmethod and staticmethod objects in python2. arguments. ([issue #262](https://github.com/cloudpipe/cloudpickle/pull/262)) +- Fix for CloudPickle Dropping Type Hints ([issue #276](https://github.com/cloudpipe/cloudpickle/pull/276)) + 1.1.1 ===== @@ -77,7 +79,7 @@ - Stop using the deprecated `imp` module under Python 3. ([issue #207](https://github.com/cloudpipe/cloudpickle/issues/207)) -- Fixed pickling issue with singleton types `NoneType`, `type(...)` and +- Fixed pickling issue with singleton types `NoneType`, `type(...)` and `type(NotImplemented)` ([issue #209](https://github.com/cloudpipe/cloudpickle/issues/209)) From ad1809a5efdf91f1ec3bda385d6f42600b16b136 Mon Sep 17 00:00:00 2001 From: Olivier Grisel Date: Tue, 4 Jun 2019 18:06:33 +0200 Subject: [PATCH 5/5] MAINT better phrasing --- CHANGES.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index fdaa4e762..f1c597160 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,7 +4,10 @@ - Support pickling of classmethod and staticmethod objects in python2. arguments. ([issue #262](https://github.com/cloudpipe/cloudpickle/pull/262)) -- Fix for CloudPickle Dropping Type Hints ([issue #276](https://github.com/cloudpipe/cloudpickle/pull/276)) +- Add support to pickle type annotations for Python 3.5 and 3.6 (pickling type + annotations was already supported for Python 3.7, Python 3.4 might also work + but is no longer officially supported by cloudpickle) + ([issue #276](https://github.com/cloudpipe/cloudpickle/pull/276)) 1.1.1 =====