mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	bpo-39353: binascii.crc_hqx() is no longer deprecated (GH-18276)
The binascii.crc_hqx() function is no longer deprecated.
This commit is contained in:
		
							parent
							
								
									2bf127d97b
								
							
						
					
					
						commit
						c38fd0df2b
					
				
					 6 changed files with 3 additions and 15 deletions
				
			
		|  | @ -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 |    *x*:sup:`16` + *x*:sup:`12` + *x*:sup:`5` + 1, often represented as | ||||||
|    0x1021.  This CRC is used in the binhex4 format. |    0x1021.  This CRC is used in the binhex4 format. | ||||||
| 
 | 
 | ||||||
|    .. deprecated:: 3.9 |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| .. function:: crc32(data[, value]) | .. function:: crc32(data[, value]) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -379,7 +379,6 @@ Deprecated | ||||||
| 
 | 
 | ||||||
|   * :func:`~binascii.b2a_hqx`, :func:`~binascii.a2b_hqx` |   * :func:`~binascii.b2a_hqx`, :func:`~binascii.a2b_hqx` | ||||||
|   * :func:`~binascii.rlecode_hqx`, :func:`~binascii.rledecode_hqx` |   * :func:`~binascii.rlecode_hqx`, :func:`~binascii.rledecode_hqx` | ||||||
|   * :func:`~binascii.crc_hqx` |  | ||||||
| 
 | 
 | ||||||
|   (Contributed by Victor Stinner in :issue:`39353`.) |   (Contributed by Victor Stinner in :issue:`39353`.) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -200,7 +200,6 @@ def _writeinfo(self, name, finfo): | ||||||
|         self._writecrc() |         self._writecrc() | ||||||
| 
 | 
 | ||||||
|     def _write(self, data): |     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) |         self.ofp.write(data) | ||||||
| 
 | 
 | ||||||
|  | @ -396,7 +395,6 @@ def __init__(self, ifp): | ||||||
| 
 | 
 | ||||||
|     def _read(self, len): |     def _read(self, len): | ||||||
|         data = self.ifp.read(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 |         return data | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -435,9 +435,6 @@ def test_deprecated_warnings(self): | ||||||
|         with self.assertWarns(DeprecationWarning): |         with self.assertWarns(DeprecationWarning): | ||||||
|             self.assertEqual(binascii.rledecode_hqx(b'a\x90\n'), b'a' * 10) |             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): | class ArrayBinASCIITest(BinASCIITest): | ||||||
|     def type2test(self, s): |     def type2test(self, s): | ||||||
|  |  | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | The :func:`binascii.crc_hqx` function is no longer deprecated. | ||||||
|  | @ -965,11 +965,6 @@ static PyObject * | ||||||
| binascii_crc_hqx_impl(PyObject *module, Py_buffer *data, unsigned int crc) | binascii_crc_hqx_impl(PyObject *module, Py_buffer *data, unsigned int crc) | ||||||
| /*[clinic end generated code: output=2fde213d0f547a98 input=56237755370a951c]*/ | /*[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; |     const unsigned char *bin_data; | ||||||
|     Py_ssize_t len; |     Py_ssize_t len; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Victor Stinner
						Victor Stinner