Skip to content

bpo-39353: binascii.crc_hqx() is no longer deprecated #18276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Doc/library/binascii.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down
1 change: 0 additions & 1 deletion Doc/whatsnew/3.9.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`.)

Expand Down
6 changes: 2 additions & 4 deletions Lib/binhex.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ def _writeinfo(self, name, finfo):
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):
Expand Down Expand Up @@ -396,8 +395,7 @@ def __init__(self, ifp):

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):
Expand Down
3 changes: 0 additions & 3 deletions Lib/test/test_binascii.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,6 @@ def test_deprecated_warnings(self):
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):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The :func:`binascii.crc_hqx` function is no longer deprecated.
5 changes: 0 additions & 5 deletions Modules/binascii.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down