Blob Blame History Raw
--- a/pytz/tests/test_tzinfo.py~	2019-07-26 08:38:47.000000000 -0500
+++ b/pytz/tests/test_tzinfo.py	2019-07-26 08:40:12.751754602 -0500
@@ -184,8 +184,11 @@
         # Python 3 introduced a new pickle protocol where numbers are stored in
         # hexadecimal representation. Here we extract the pickle
         # representation of the number for the current Python version.
-        old_pickle_pattern = pickle.dumps(tz._utcoffset.seconds)[3:-1]
-        new_pickle_pattern = pickle.dumps(new_utcoffset)[3:-1]
+        #
+        # Test protocol 3 on Python 3 and protocol 0 on Python 2.
+        protocol = (3 if sys.version_info >= (3,) else 0)
+        old_pickle_pattern = pickle.dumps(tz._utcoffset.seconds, protocol)[3:-1]
+        new_pickle_pattern = pickle.dumps(new_utcoffset, protocol)[3:-1]
         hacked_p = p.replace(old_pickle_pattern, new_pickle_pattern)
 
         self.assertNotEqual(p, hacked_p)