bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25171)

* Fix test_float
* Fix _osx_support
* Fix test_fstring
* Fix test_gc
* Fix test_gzip
* Fix test_hashlib
* Fix unrelated whitespace issue

Co-authored-by: Ned Deily <nad@python.org>
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
index 99c81f0..ff4f387 100644
--- a/Lib/test/test_float.py
+++ b/Lib/test/test_float.py
@@ -729,7 +729,7 @@ def test_format(self):
 
     @support.requires_IEEE_754
     def test_format_testfile(self):
-        with open(format_testfile) as testfile:
+        with open(format_testfile, encoding="utf-8") as testfile:
             for line in testfile:
                 if line.startswith('--'):
                     continue
@@ -769,7 +769,7 @@ def test_issue35560(self):
 class ReprTestCase(unittest.TestCase):
     def test_repr(self):
         with open(os.path.join(os.path.split(__file__)[0],
-                  'floating_points.txt')) as floats_file:
+                  'floating_points.txt'), encoding="utf-8") as floats_file:
             for line in floats_file:
                 line = line.strip()
                 if not line or line.startswith('#'):