]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39353: binascii.crc_hqx() is no longer deprecated (GH-18276)
authorVictor Stinner <vstinner@python.org>
Thu, 30 Jan 2020 08:56:40 +0000 (09:56 +0100)
committerGitHub <noreply@github.com>
Thu, 30 Jan 2020 08:56:40 +0000 (09:56 +0100)
The binascii.crc_hqx() function is no longer deprecated.

Doc/library/binascii.rst
Doc/whatsnew/3.9.rst
Lib/binhex.py
Lib/test/test_binascii.py
Misc/NEWS.d/next/Library/2020-01-30-09-07-16.bpo-39353.wTl9hc.rst [new file with mode: 0644]
Modules/binascii.c

index aa2a27084c34c521b6fa92d175526e62c75adb15..2c0c1bce5d7f8f9a0f18f0be815a0c4c5605b6df 100644 (file)
@@ -132,8 +132,6 @@ The :mod:`binascii` module defines the following functions:
    *x*:sup:`16` + *x*:sup:`12` + *x*:sup:`5` + 1, often represented as
    0x1021.  This CRC is used in the binhex4 format.
 
-   .. deprecated:: 3.9
-
 
 .. function:: crc32(data[, value])
 
index a4c4266bfc35dcf45ff3972e200856af1715b4ea..c8f407751ec5e256755b7dac9281b9f9e06b4d8c 100644 (file)
@@ -379,7 +379,6 @@ Deprecated
 
   * :func:`~binascii.b2a_hqx`, :func:`~binascii.a2b_hqx`
   * :func:`~binascii.rlecode_hqx`, :func:`~binascii.rledecode_hqx`
-  * :func:`~binascii.crc_hqx`
 
   (Contributed by Victor Stinner in :issue:`39353`.)
 
index 6ff38dd8229c8b9934867007d1f781ddd7d2a404..9559f46d5a288215f9ebfd5a114174f8326ed2bf 100644 (file)
@@ -200,8 +200,7 @@ class BinHex:
         self._writecrc()
 
     def _write(self, data):
-        with _ignore_deprecation_warning():
-            self.crc = binascii.crc_hqx(data, self.crc)
+        self.crc = binascii.crc_hqx(data, self.crc)
         self.ofp.write(data)
 
     def _writecrc(self):
@@ -396,8 +395,7 @@ class HexBin:
 
     def _read(self, len):
         data = self.ifp.read(len)
-        with _ignore_deprecation_warning():
-            self.crc = binascii.crc_hqx(data, self.crc)
+        self.crc = binascii.crc_hqx(data, self.crc)
         return data
 
     def _checkcrc(self):
index 649edbe2954134319a38ab3bda0376298a32c290..45327953a7701ad1741f54a7cd54b62527528d0f 100644 (file)
@@ -435,9 +435,6 @@ class BinASCIITest(unittest.TestCase):
         with self.assertWarns(DeprecationWarning):
             self.assertEqual(binascii.rledecode_hqx(b'a\x90\n'), b'a' * 10)
 
-        with self.assertWarns(DeprecationWarning):
-            self.assertEqual(binascii.crc_hqx(b'abc', 0), 40406)
-
 
 class ArrayBinASCIITest(BinASCIITest):
     def type2test(self, s):
diff --git a/Misc/NEWS.d/next/Library/2020-01-30-09-07-16.bpo-39353.wTl9hc.rst b/Misc/NEWS.d/next/Library/2020-01-30-09-07-16.bpo-39353.wTl9hc.rst
new file mode 100644 (file)
index 0000000..b6db7c5
--- /dev/null
@@ -0,0 +1 @@
+The :func:`binascii.crc_hqx` function is no longer deprecated.
index c6da3e0a635bcafe5373d90a64f01a0a03dc4083..e428b0d6f963f7c3ec06b57f75d22efb9fc29475 100644 (file)
@@ -965,11 +965,6 @@ static PyObject *
 binascii_crc_hqx_impl(PyObject *module, Py_buffer *data, unsigned int crc)
 /*[clinic end generated code: output=2fde213d0f547a98 input=56237755370a951c]*/
 {
-    if (PyErr_WarnEx(PyExc_DeprecationWarning,
-                     "binascii.crc_hqx() is deprecated", 1) < 0) {
-        return NULL;
-    }
-
     const unsigned char *bin_data;
     Py_ssize_t len;