Commit Graph

10 Commits

Author SHA1 Message Date
sweeneyde 6a9e80a931
bpo-40313: speed up bytes.hex() (GH-19594)
Automerge-Triggered-By: @gpshead
2020-04-20 17:17:52 -07:00
Victor Stinner 455df97798
Optimize _Py_strhex_impl() (GH-19535)
Avoid a temporary buffer to create a bytes string: use
PyBytes_FromStringAndSize() to directly allocate a bytes object.

Cleanup also the code: PEP 7 formatting, move variable definitions
closer to where they are used. Fix assertion checking "j" index.
2020-04-15 14:05:24 +02:00
Raymond Hettinger 0138c4ceab
Fix unused variable and signed/unsigned warnings (GH-15537) 2019-08-27 09:55:13 -07:00
Pablo Galindo 938d9a0167
Fix compiler warnings in the pystrehex module (GH-13730) 2019-06-01 21:02:08 +01:00
Gregory P. Smith 0c2f930564
bpo-22385: Support output separators in hex methods. (#13578)
* 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
2019-05-29 11:46:58 -07:00
Benjamin Peterson e502451781
closes bpo-34646: Remove PyAPI_* macros from declarations. (GH-9218) 2018-09-12 12:06:42 -07:00
Serhiy Storchaka 598ceae876
bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
Gregory P. Smith f789465eed Silence a gcc "may be used uninitialized" compiler warning. Not true.
Initializing retval prevents the naive warning.
2015-04-25 23:51:39 -07:00
Gregory P. Smith 5d0ccd2f91 Add missing PyAPI_FUNC macro's to the public functions as other .c files do
in hopes that this fixes the windows extension module link error for modules
trying to call _Py_strhex functions.  issue9951.
2015-04-26 04:59:52 +00:00
Gregory P. Smith e3f6393b52 Add the files missing from c9f1630cf2b1 for issue9951.
hg status should be my friend more often...
2015-04-26 00:41:00 +00:00