summaryrefslogtreecommitdiffstats
path: root/Modules/binascii.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-15999: Accept arbitrary values for boolean parameters. (#15609)Serhiy Storchaka2022-12-031-12/+12
| | | builtins and extension module functions and methods that expect boolean values for parameters now accept any Python object rather than just a bool or int type. This is more consistent with how native Python code itself behaves.
* gh-93172: Remove unnecessary "if"s in binascii_a2b_qp_impl() from ↵oda-gitso2022-05-251-8/+2
| | | | Modules/binascii.c (GH-93181)
* bpo-38256: Fix binascii.crc32() when inputs are 4+GiB (GH-32000)Gregory P. Smith2022-03-201-24/+51
| | | | | | | When compiled with `USE_ZLIB_CRC32` defined (`configure` sets this on POSIX systems), `binascii.crc32(...)` failed to compute the correct value when the input data was >= 4GiB. Because the zlib crc32 API is limited to a 32-bit length. This lines it up with the `zlib.crc32(...)` implementation that doesn't have that flaw. **Performance:** This also adopts the same GIL releasing for larger inputs logic that `zlib.crc32` has, and causes the Windows build to always use zlib's crc32 instead of our slow C code as zlib is a required build dependency on Windows.
* bpo-43974: Move Py_BUILD_CORE_MODULE into module code (GH-29157)Christian Heimes2021-10-221-0/+4
| | | | | | | | | | | | | | setup.py no longer defines Py_BUILD_CORE_MODULE. Instead every module defines the macro before #include "Python.h" unless Py_BUILD_CORE_BUILTIN is already defined. Py_BUILD_CORE_BUILTIN is defined for every module that is built by Modules/Setup. The PR also simplifies Modules/Setup. Makefile and makesetup already define Py_BUILD_CORE_BUILTIN and include Modules/internal for us. Signed-off-by: Christian Heimes <christian@python.org>
* bpo-35134: Add Include/cpython/longobject.h (GH-29044)Victor Stinner2021-10-191-0/+1
| | | | | | | | | | Move Include/longobject.h non-limited API to a new Include/cpython/longobject.h header file. Move the following definitions to the internal C API: * _PyLong_DigitValue * _PyLong_FormatAdvancedWriter() * _PyLong_FormatWriter()
* bpo-45434: Remove pystrhex.h header file (GH-28923)Victor Stinner2021-10-131-2/+2
| | | | | | | | | | | | | | | Move Include/pystrhex.h to Include/internal/pycore_strhex.h. The header file only contains private functions. The following C extensions are now built with Py_BUILD_CORE_MODULE macro defined to get access to the internal C API: * _blake2 * _hashopenssl * _md5 * _sha1 * _sha3 * _ssl * binascii
* bpo-45085: Remove the binhex module (GH-28117)Victor Stinner2021-09-021-418/+0
| | | | | | | | | | The binhex module, deprecated in Python 3.9, is now removed. The following binascii functions, deprecated in Python 3.9, are now also removed: * a2b_hqx(), b2a_hqx(); * rlecode_hqx(), rledecode_hqx(). The binascii.crc_hqx() function remains available.
* bpo-44678: Separate error message for discontinuous padding in ↵Idan Moral2021-07-191-2/+5
| | | | | | | binascii.a2b_base64 strict mode (GH-27249) * Renamed assertLeadingPadding function to match logic * Added a separate error message for discontinuous padding * Updated the tests for discontinuous padding
* bpo-43086: Add handling for out-of-spec data in a2b_base64 (GH-24402)Idan Moral2021-07-191-6/+46
| | | | | | | binascii.a2b_base64 gains a strict_mode= parameter. When enabled it will raise an error on input that deviates from the base64 spec in any way. The default remains False for backward compatibility. Code reviews and minor tweaks by: Gregory P. Smith <greg@krypto.org> [Google]
* Use get_binascii_state instead of PyModule_GetState (GH-26069)Dong-hee Na2021-05-121-13/+13
|
* Use calloc-based functions, not malloc. (GH-19152)Andy Lester2020-03-251-8/+2
|
* bpo-39824: module_traverse() don't call m_traverse if md_state=NULL (GH-18738)Victor Stinner2020-03-171-9/+5
| | | | | | | | | | | | | Extension modules: m_traverse, m_clear and m_free functions of PyModuleDef are no longer called if the module state was requested but is not allocated yet. This is the case immediately after the module is created and before the module is executed (Py_mod_exec function). More precisely, these functions are not called if m_size is greater than 0 and the module state (as returned by PyModule_GetState()) is NULL. Extension modules without module state (m_size <= 0) are not affected. Co-Authored-By: Petr Viktorin <encukou@gmail.com>
* bpo-1635741: Fix potential refleaks in binascii module (GH-18613)Hai Shi2020-03-111-7/+45
|
* bpo-39353: binascii.crc_hqx() is no longer deprecated (GH-18276)Victor Stinner2020-01-301-5/+0
| | | The binascii.crc_hqx() function is no longer deprecated.
* bpo-39353: Deprecate the binhex module (GH-18025)Victor Stinner2020-01-221-4/+29
| | | | | | | | Deprecate binhex4 and hexbin4 standards. Deprecate the binhex module and the following binascii functions: * b2a_hqx(), a2b_hqx() * rlecode_hqx(), rledecode_hqx() * crc_hqx()
* bpo-34749: Improved performance of binascii.a2b_base64(). (GH-9444)Sergey Fedoseev2019-07-141-86/+56
| | | https://bugs.python.org/issue34749
* bpo-22385: Support output separators in hex methods. (#13578)Gregory P. Smith2019-05-291-8/+25
| | | | | | | | | | | | | | | | | | * bpo-22385: Support output separators in hex methods. Also in binascii.hexlify aka b2a_hex. The underlying implementation behind all hex generation in CPython uses the same pystrhex.c implementation. This adds support to bytes, bytearray, and memoryview objects. The binascii module functions exist rather than being slated for deprecation because they return bytes rather than requiring an intermediate step through a str object. This change was inspired by MicroPython which supports sep in its binascii implementation (and does not yet support the .hex methods). https://bugs.python.org/issue22385
* bpo-31862: Port binascii to PEP 489 multiphase initialization (GH-4108)Marcel Plch2019-05-221-34/+103
|
* bpo-36254: Fix invalid uses of %d in format strings in C. (GH-12264)Serhiy Storchaka2019-03-131-1/+1
|
* bpo-34736: improve error message for invalid length b64decode inputs (GH-9563)Tal Einat2018-09-281-3/+7
| | | | | | | | Improvements: 1. Include the number of valid data characters in the error message. 2. Mention "number of data characters" rather than "length". https://bugs.python.org/issue34736
* bpo-33770: improve base64 exception message for encoded inputs of invalid ↵Tal Einat2018-06-101-1/+12
| | | | length (#7416)
* bpo-32147: Improved perfomance of binascii.unhexlify(). (GH-4586)Sergey Fedoseev2018-02-261-33/+5
|
* bpo-9566: Fix some Windows x64 compiler warnings (#2492)Segev Finer2017-07-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bpo-9566: Silence liblzma warnings * bpo-9566: Silence tcl warnings * bpo-9566: Silence tk warnings * bpo-9566: Silence tix warnings * bpo-9566: Fix some library warnings * bpo-9566: Fix msvcrtmodule.c warnings * bpo-9566: Silence _bz2 warnings * bpo-9566: Fixed some _ssl warnings * bpo-9566: Fix _msi warnings * bpo-9566: Silence _ctypes warnings * Revert "bpo-9566: Fixed some _ssl warnings" This reverts commit a639001c949ba53338a9ee047d2ec1efd2505e6f. * bpo-9566: Also consider NULL as a possible error in HANDLE_return_converter * bpo-9566: whitespace fixes
* bpo-30103: Allow Uuencode in Python using backtick as zero instead of space ↵Xiang Zhang2017-05-031-4/+12
| | | | | | (#1326)
* restore *data* parameter of binascii.b2a_base64 to positional-only (#1352)Xiang Zhang2017-05-011-1/+2
|
* bpo-24037: Add Argument Clinic converter `bool(accept={int})`. (#485)Serhiy Storchaka2017-03-121-8/+8
|
* Issue #29004: Merge crc_hqx() doc from 3.5Martin Panter2016-12-241-2/+2
|\
| * Issue #29004: Document binascii.crc_hqx() implements CRC-CCITTMartin Panter2016-12-241-2/+2
| |
* | Issue #27599: Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp().Serhiy Storchaka2016-09-141-5/+7
|\ \ | |/
| * Issue #27599: Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp().Serhiy Storchaka2016-09-141-5/+7
| |
* | Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Raymond Hettinger2016-08-301-2/+2
| |
* | merge 3.5 (closes #27760)Benjamin Peterson2016-08-141-9/+15
|\ \ | |/
| * merge 3.4 (closes #27760)Benjamin Peterson2016-08-141-9/+15
| |\
| | * merge 3.3 (closes #27760)Benjamin Peterson2016-08-141-9/+15
| | |\
| | | * fix possible integer overflow in binascii.b2a_qp (closes #27760)Benjamin Peterson2016-08-141-9/+16
| | | | | | | | | | | | | | | | Reported by Thomas E. Hybel
* | | | - Issue #27332: Fixed the type of the first argument of module-level functionsSerhiy Storchaka2016-07-071-32/+32
|\ \ \ \ | |/ / / | | | | | | | | generated by Argument Clinic. Patch by Petr Viktorin.
| * | | Issue #27332: Fixed the type of the first argument of module-level functionsSerhiy Storchaka2016-07-071-32/+32
| | | | | | | | | | | | | | | | generated by Argument Clinic. Patch by Petr Viktorin.
* | | | Issue #25923: Added more const qualifiers to signatures of static and ↵Serhiy Storchaka2015-12-251-17/+27
| | | | | | | | | | | | | | | | private functions.
* | | | Issue #25923: Added the const qualifier to static constant arrays.Serhiy Storchaka2015-12-251-7/+7
| | | |
* | | | Refactor binascii.rledecode_hqx()Victor Stinner2015-10-141-28/+25
| | | | | | | | | | | | | | | | Rewrite the code to handle the output buffer.
* | | | Issue #25384: Fix binascii.rledecode_hqx()Victor Stinner2015-10-141-4/+7
| | | | | | | | | | | | | | | | | | | | Fix usage of _PyBytesWriter API. Use the new _PyBytesWriter_Resize() function instead of _PyBytesWriter_Prepare().
* | | | Issue #25384: Use _PyBytesWriter API in binasciiVictor Stinner2015-10-131-111/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This API avoids a final call to _PyBytes_Resize() for output smaller than 512 bytes. Small optimization: disable overallocation in binascii.rledecode_hqx() for the last write.
* | | | Issue #25357: Add an optional newline paramer to binascii.b2a_base64().Victor Stinner2015-10-111-8/+13
|/ / / | | | | | | | | | base64.b64encode() uses it to avoid a memory copy.
* | | Switch binascii over to using the common _Py_strhex implementation for its hexGregory P. Smith2015-04-261-28/+3
| | | | | | | | | | | | and hexlify functions. issue9951.
* | | Issue #23728: binascii.crc_hqx() could return an integer outside of the rangeSerhiy Storchaka2015-04-201-8/+8
|\ \ \ | |/ / | | | | | | 0-0xffff for empty data.
| * | Issue #23728: binascii.crc_hqx() could return an integer outside of the rangeSerhiy Storchaka2015-04-201-8/+8
| | | | | | | | | | | | 0-0xffff for empty data.
* | | Issue #23944: Argument Clinic now wraps long impl prototypes at column 78.Larry Hastings2015-04-141-2/+3
| | |
* | | Issue #23501: Argumen Clinic now generates code into separate files by default.Serhiy Storchaka2015-04-031-2/+1
|/ /
* | Issue #13637: Improve exception message of a2b_* functions.Berker Peksag2015-02-141-2/+2
| | | | | | | | Patch by Vajrasky Kok.
* | Issue #23280: Fix docstrings for binascii.(un)hexlifyZachary Ware2015-01-201-4/+31
| |