https://github.com/python/cpython/commit/f928475886ee36f0b6d10300a79578d2750590be
commit: f928475886ee36f0b6d10300a79578d2750590be
branch: main
author: Danny Lin <[email protected]>
committer: StanFromIreland <[email protected]>
date: 2026-06-22T15:11:24+01:00
summary:

gh-151866: Remove unneeded `zlib` dependency in `test_zipfile.test_core` 
(#135631)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <[email protected]>

files:
M Lib/test/test_zipfile/test_core.py

diff --git a/Lib/test/test_zipfile/test_core.py 
b/Lib/test/test_zipfile/test_core.py
index c0f3efaf0921da..4f20209927e7b3 100644
--- a/Lib/test/test_zipfile/test_core.py
+++ b/Lib/test/test_zipfile/test_core.py
@@ -4089,8 +4089,7 @@ def create_zipfile_with_extra_data(self, filename, 
extra_data_name):
             tag_for_unicode_path = b'\x75\x70'
             version_of_unicode_path = b'\x01'
 
-            import zlib
-            filename_crc = struct.pack('<L', zlib.crc32(filename_encoded))
+            filename_crc = struct.pack('<L', zipfile.crc32(filename_encoded))
 
             extra_data = version_of_unicode_path + filename_crc + 
extra_data_name
             tsize = len(extra_data).to_bytes(2, 'little')
@@ -4100,19 +4099,16 @@ def create_zipfile_with_extra_data(self, filename, 
extra_data_name):
             # add the file to the ZIP archive
             zf.writestr(zip_info, b'Hello World!')
 
-    @requires_zlib()
     def test_read_zipfile_containing_unicode_path_extra_field(self):
         self.create_zipfile_with_extra_data("이름.txt", "이름.txt".encode("utf-8"))
         with zipfile.ZipFile(TESTFN, "r") as zf:
             self.assertEqual(zf.filelist[0].filename, "이름.txt")
 
-    @requires_zlib()
     def test_read_zipfile_warning(self):
         self.create_zipfile_with_extra_data("이름.txt", b"")
         with self.assertWarns(UserWarning):
             zipfile.ZipFile(TESTFN, "r").close()
 
-    @requires_zlib()
     def test_read_zipfile_error(self):
         self.create_zipfile_with_extra_data("이름.txt", b"\xff")
         with self.assertRaises(zipfile.BadZipfile):

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to