R David Murray
110b6fecbb
#27364 : Deprecate invalid escape strings in str/byutes.
...
Patch by Emanuel Barry, reviewed by Serhiy Storchaka and Martin Panter.
2016-09-08 15:34:08 -04:00
Raymond Hettinger
15f44ab043
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
2016-08-30 10:47:49 -07:00
Martin Panter
1b6c6da85d
Issue #27506 : Support bytes/bytearray.translate() delete as keyword argument
...
Patch by Xiang Zhang.
2016-08-27 08:35:02 +00:00
Serhiy Storchaka
eb24988962
Issue #27704 : Optimized creating bytes and bytearray from byte-like objects
...
and iterables. Speed up to 3 times for short objects. Original patch by
Naoki Inada.
2016-08-15 09:46:07 +03:00
Serhiy Storchaka
ca0da9b0a3
Issue #27473 : Fixed possible integer overflow in bytes and bytearray
...
concatenations. Patch by Xiang Zhang.
2016-07-10 20:51:35 +03:00
Serhiy Storchaka
06cfb0cd70
Issue #27473 : Fixed possible integer overflow in bytes and bytearray
...
concatenations. Patch by Xiang Zhang.
2016-07-10 20:48:43 +03:00
Serhiy Storchaka
f54d7811c3
Issue #27460 : Unified error messages in bytes constructor for integers
...
in and out of the Py_ssize_t range. Patch by Xiang Zhang.
2016-07-06 21:39:44 +03:00
Serhiy Storchaka
e09132f2c7
Backed out changeset b0087e17cd5e (issue #26765 )
...
For unknown reasons it perhaps caused a crash on 32-bit Windows (issue #).
2016-07-03 13:57:48 +03:00
Serhiy Storchaka
355048970b
Issue #26765 : Moved wrappers for bytes and bytearray methods to common header
...
file.
2016-07-01 17:57:30 +03:00
Serhiy Storchaka
0855e706aa
Issue #27007 : The fromhex() class methods of bytes and bytearray subclasses
...
now return an instance of corresponding subclass.
2016-07-01 17:22:31 +03:00
Martin Panter
e514093a2f
Issue #27125 : Merge typo fixes from 3.5
2016-05-30 05:24:49 +00:00
Martin Panter
a90a4a9651
Issue #27125 : Remove duplicated words from documentation and comments
2016-05-30 04:04:50 +00:00
Serhiy Storchaka
fb81d3cbe7
Issue #26765 : Moved common code for the replace() method of bytes and bytearray
...
to a template file.
2016-05-05 09:26:07 +03:00
Serhiy Storchaka
dd40fc3e57
Issue #26765 : Moved common code and docstrings for bytes and bytearray methods
...
to bytes_methods.c.
2016-05-04 22:23:26 +03:00
Serhiy Storchaka
7a9579c0ce
Got rid of redundand "self" parameter declarations.
...
Argument Clinic is now able to infer all needed information.
2016-05-02 13:45:20 +03:00
Victor Stinner
71dc3d878a
Issue #25349 , #26249 : Fix memleak in formatfloat()
2016-04-26 12:35:13 +02:00
Victor Stinner
e914d41312
Issue #26766 : Fix _PyBytesWriter_Finish()
...
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.
2016-04-15 17:52:27 +02:00
Serhiy Storchaka
c9a59e6e4f
Issue #26764 : Fixed SystemError in bytes.__rmod__.
2016-04-15 14:11:10 +03:00
Serhiy Storchaka
f01e408c16
Issue #26200 : Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
...
in places where Py_DECREF was used.
2016-04-10 18:12:01 +03:00
Serhiy Storchaka
57a01d3a0e
Issue #26200 : Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
...
in places where Py_DECREF was used.
2016-04-10 18:05:40 +03:00
Serhiy Storchaka
03f17f8671
Issue #17339 : Improved TypeError message in bytes constructor.
2016-04-10 14:44:59 +03:00
Serhiy Storchaka
ec39756960
Issue #22570 : Renamed Py_SETREF to Py_XSETREF.
2016-04-06 09:50:03 +03:00
Serhiy Storchaka
48842714b9
Issue #22570 : Renamed Py_SETREF to Py_XSETREF.
2016-04-06 09:45:48 +03:00
Serhiy Storchaka
ab479c49d3
Issue #26494 : Fixed crash on iterating exhausting iterators.
...
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:41:15 +03:00
Serhiy Storchaka
fbb1c5ee06
Issue #26494 : Fixed crash on iterating exhausting iterators.
...
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:40:02 +03:00
Victor Stinner
fac395681f
Optimize bytes.replace(b'', b'.')
...
Issue #26574 : Optimize bytes.replace(b'', b'.') and
bytearray.replace(b'', b'.'): up to 80% faster. Patch written by Josh Snider.
2016-03-21 10:38:58 +01:00
Serhiy Storchaka
ef1585eb9a
Issue #25923 : Added more const qualifiers to signatures of static and private functions.
2015-12-25 20:01:53 +02:00
Serhiy Storchaka
f006940351
Issue #20440 : Massive replacing unsafe attribute setting code with special
...
macro Py_SETREF.
2015-12-24 10:39:57 +02:00
Serhiy Storchaka
5a57ade58e
Issue #20440 : Massive replacing unsafe attribute setting code with special
...
macro Py_SETREF.
2015-12-24 10:35:59 +02:00
Serhiy Storchaka
3182db356c
Issue #25766 : Special method __bytes__() now works in str subclasses.
2015-12-20 16:37:21 +02:00
Serhiy Storchaka
5aac3ed799
Issue #25766 : Special method __bytes__() now works in str subclasses.
2015-12-20 16:36:34 +02:00
Serhiy Storchaka
bb6e4a0b31
Issue #24731 : Fixed crash on converting objects with special methods
...
__bytes__, __trunc__, and __float__ returning instances of subclasses of
bytes, int, and float to subclasses of bytes, int, and float correspondingly.
2015-11-25 15:53:19 +02:00
Serhiy Storchaka
f9afda57ad
Issue #24731 : Fixed crash on converting objects with special methods
...
__bytes__, __trunc__, and __float__ returning instances of subclasses of
bytes, int, and float to subclasses of bytes, int, and float correspondingly.
2015-11-25 15:52:04 +02:00
Serhiy Storchaka
15095800a3
Issue #24731 : Fixed crash on converting objects with special methods
...
__bytes__, __trunc__, and __float__ returning instances of subclasses of
bytes, int, and float to subclasses of bytes, int, and float correspondingly.
2015-11-25 15:47:01 +02:00
Serhiy Storchaka
413fdcea21
Issue #24821 : Refactor STRINGLIB(fastsearch_memchr_1char) and split it on
...
STRINGLIB(find_char) and STRINGLIB(rfind_char) that can be used independedly
without special preconditions.
2015-11-14 15:42:17 +02:00
Victor Stinner
c3d2bc19e4
Use _PyBytesWriter in _PyBytes_FromIterator()
2015-10-14 14:15:49 +02:00
Victor Stinner
c5c3ba4bec
Add _PyBytesWriter_Resize() function
...
This function gives a control to the buffer size without using min_size.
2015-10-14 13:56:47 +02:00
Victor Stinner
3c50ce39bf
Factorize _PyBytes_FromList() and _PyBytes_FromTuple() code using a C macro
2015-10-14 13:50:40 +02:00
Victor Stinner
f2eafa323b
Split PyBytes_FromObject() into subfunctions
2015-10-14 13:44:29 +02:00
Victor Stinner
2ec8063cc9
Modify _PyBytes_DecodeEscapeRecode() to use _PyBytesAPI
...
* 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
2015-10-14 13:32:13 +02:00
Victor Stinner
f6358a7e4c
_PyBytesWriter_Alloc(): only use 10 bytes of the small buffer in debug mode to
...
enhance code to detect buffer under- and overflow.
2015-10-14 12:02:39 +02:00
Victor Stinner
2bf8993db9
Optimize bytes.fromhex() and bytearray.fromhex()
...
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
2015-10-14 11:25:33 +02:00
Victor Stinner
772b2b09f2
Optimize bytearray % args
...
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.
2015-10-14 09:56:53 +02:00
Victor Stinner
661aaccf9d
Add use_bytearray attribute to _PyBytesWriter
...
Issue #25399 : Add a new use_bytearray attribute to _PyBytesWriter to use a
bytearray buffer, instead of using a bytes object.
2015-10-14 09:41:48 +02:00
Victor Stinner
03dab786b2
Rewrite PyBytes_FromFormatV() using _PyBytesWriter API
...
* 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
2015-10-14 00:21:35 +02:00
Victor Stinner
e9aa5950bb
Fix compilation error in _PyBytesWriter_WriteBytes() on Windows
2015-10-12 13:57:47 +02:00
Victor Stinner
6c2cdae9e6
Writer APIs: use empty string singletons
...
Modify _PyBytesWriter_Finish() and _PyUnicodeWriter_Finish() to return the
empty bytes/Unicode string if the string is empty.
2015-10-12 13:29:43 +02:00
Victor Stinner
c29e29bed1
Relax _PyBytesWriter API
...
Don't require _PyBytesWriter pointer to be a "char *". Same change for
_PyBytesWriter_WriteBytes() parameter.
For example, binascii uses "unsigned char*".
2015-10-12 13:12:54 +02:00
Victor Stinner
0cdad1e2bc
Issue #25349 : Add fast path for b'%c' % int
...
Optimize also %% formater.
2015-10-09 22:50:36 +02:00
Victor Stinner
be75b8cf23
Issue #25349 : Optimize bytes % int
...
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.
2015-10-09 22:43:24 +02:00