| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|\ \
| |/ |
|
| | |
|
| |
| |
| |
| | |
to a template file.
|
| |
| |
| |
| | |
to bytes_methods.c.
|
| |
| |
| |
| | |
Argument Clinic is now able to infer all needed information.
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
Return a bytearray object when bytearray is requested and when the small buffer
is used.
Fix also test_bytes: bytearray%args must return a bytearray type.
|
| | |
|
|\ \
| |/
| |
| | |
in places where Py_DECREF was used.
|
| |
| |
| |
| | |
in places where Py_DECREF was used.
|
| | |
|
|\ \
| |/ |
|
| | |
|
|\ \
| |/
| |
| |
| |
| | |
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
|
| |
| |
| |
| |
| |
| | |
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
|
| |
| |
| |
| |
| | |
Issue #26574: Optimize bytes.replace(b'', b'.') and
bytearray.replace(b'', b'.'): up to 80% faster. Patch written by Josh Snider.
|
| |
| |
| |
| | |
private functions.
|
|\ \
| |/
| |
| | |
macro Py_SETREF.
|
| |
| |
| |
| | |
macro Py_SETREF.
|
|\ \
| |/ |
|
| | |
|
|\ \
| |/
| |
| |
| | |
__bytes__, __trunc__, and __float__ returning instances of subclasses of
bytes, int, and float to subclasses of bytes, int, and float correspondingly.
|
| |\
| | |
| | |
| | |
| | | |
__bytes__, __trunc__, and __float__ returning instances of subclasses of
bytes, int, and float to subclasses of bytes, int, and float correspondingly.
|
| | |
| | |
| | |
| | |
| | | |
__bytes__, __trunc__, and __float__ returning instances of subclasses of
bytes, int, and float to subclasses of bytes, int, and float correspondingly.
|
| | |
| | |
| | |
| | |
| | | |
STRINGLIB(find_char) and STRINGLIB(rfind_char) that can be used independedly
without special preconditions.
|
| | | |
|
| | |
| | |
| | |
| | | |
This function gives a control to the buffer size without using min_size.
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* Don't overallocate by 400% when recode is needed: only overallocate on demand
using _PyBytesWriter.
* Use _PyLong_DigitValue to convert hexadecimal digit to int
* Create _PyBytes_DecodeEscapeRecode() subfunction
|
| | |
| | |
| | |
| | | |
enhance code to detect buffer under- and overflow.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Issue #25401: Optimize bytes.fromhex() and bytearray.fromhex(): they are now
between 2x and 3.5x faster. Changes:
* Use a fast-path working on a char* string for ASCII string
* Use a slow-path for non-ASCII string
* Replace slow hex_digit_to_int() function with a O(1) lookup in
_PyLong_DigitValue precomputed table
* Use _PyBytesWriter API to handle the buffer
* Add unit tests to check the error position in error messages
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Issue #25399: Don't create temporary bytes objects: modify _PyBytes_Format() to
create work directly on bytearray objects.
* Rename _PyBytes_Format() to _PyBytes_FormatEx() just in case if something
outside CPython uses it
* _PyBytes_FormatEx() now uses (char*, Py_ssize_t) for the input string, so
bytearray_format() doesn't need tot create a temporary input bytes object
* Add use_bytearray parameter to _PyBytes_FormatEx() which is passed to
_PyBytesWriter, to create a bytearray buffer instead of a bytes buffer
Most formatting operations are now between 2.5 and 5 times faster.
|
| | |
| | |
| | |
| | |
| | | |
Issue #25399: Add a new use_bytearray attribute to _PyBytesWriter to use a
bytearray buffer, instead of using a bytes object.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* Add much more unit tests on PyBytes_FromFormatV()
* Remove the first loop to compute the length of the output string
* Use _PyBytesWriter to handle the bytes buffer, use overallocation
* Cleanup the code to make simpler and easier to review
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
Modify _PyBytesWriter_Finish() and _PyUnicodeWriter_Finish() to return the
empty bytes/Unicode string if the string is empty.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Don't require _PyBytesWriter pointer to be a "char *". Same change for
_PyBytesWriter_WriteBytes() parameter.
For example, binascii uses "unsigned char*".
|
| | |
| | |
| | |
| | | |
Optimize also %% formater.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Optimize bytes.__mod__(args) for integere formats: %d (%i, %u), %o, %x and %X.
_PyBytesWriter is now used to format directly the integer into the writer
buffer, instead of using a temporary bytes object.
Formatting is between 30% and 50% faster on a microbenchmark.
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
Substract preallocate bytes from min_size before calling
_PyBytesWriter_Prepare().
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* Thanks to the _PyBytesWriter API, output smaller than 512 bytes are allocated
on the stack and so avoid calling _PyBytes_Resize(). Because of that, change
the default buffer size to fmtcnt instead of fmtcnt+100.
* Rely on _PyBytesWriter algorithm to overallocate the buffer instead of using
a custom code. For example, _PyBytesWriter uses a different overallocation
factor (25% or 50%) depending on the platform to get best performances.
* Disable overallocation for the last write.
* Replace C loops to fill characters with memset()
* Add also many comments to _PyBytes_Format()
* Remove unused FORMATBUFLEN constant
* Avoid the creation of a temporary bytes object when formatting a floating
point number (when no custom formatting option is used)
* Fix also reference leaks on error handling
* Use Py_MEMCPY() to copy bytes between two formatters (%)
|
| | |
| | |
| | |
| | |
| | |
| | | |
Rename "stack buffer" to "small buffer".
Add also an assertion in _PyBytesWriter_GetPos().
|
| | |
| | |
| | |
| | | |
Replace "#if Py_DEBUG" with "#ifdef Py_DEBUG".
|
|/ /
| |
| |
| | |
Declare also the private API in bytesobject.h.
|
| |
| |
| |
| | |
for single-byte argument on Linux.
|
|\ \
| |/
| |
| |
| | |
PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains()
to check for and handle errors correctly.
|
| |
| |
| |
| |
| | |
PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains()
to check for and handle errors correctly.
|