| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
| |
Also improve error message on overflow.
|
| |
|
|
| |
first argument.
|
| |
|
|
|
|
| |
but disabled then because str and unicode strings gave different
results. The implementations were repaired later during the
sprint, but the new test remained disabled.
|
| | |
|
| | |
|
| |
|
|
| |
the current behaviour ;-)
|
| |
|
|
| |
feel free to add more tests and improve the documentation.
|
| |
|
|
| |
even with strip(..., 0)
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
The new split functions use a preallocated list. Added tests which exceed
the preallocation size, to exercise list appends/resizes.
Also added more edge case tests.
|
| | |
|
| |
|
|
| |
leading whitespace.
|
| |
|
|
| |
feel free to improve the documentation and the docstrings.
|
| | |
|
| | |
|
| |
|
|
| |
sprint.
|
| |
|
|
|
| |
be make to pass now for unicode if it passes for str, or
vice versa.
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
the Need For Speed sprint coding. Includes commented out overflow tests
which will be uncommented once the code is fixed.
This test will break the 8-bit string tests because
"".replace("", "A") == "" when it should == "A"
We have a fix for it, which should be added tomorrow.
|
| | |
|
| |
|
|
|
|
|
|
| |
[ 1327110 ] wrong TypeError traceback in generator expressions
by removing the code that can stomp on the users' TypeError raised by the
iterable argument to ''.join() -- PySequence_Fast (now?) gives a perfectly
reasonable message itself. Also, a couple of tests.
|
| | |
|
| |
|
|
| |
* Speed-up str.count() by using memchr() to fly between first char matches.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Speed-up "x in y" where x has more than one character.
The existing code made excessive calls to the expensive memcmp() function.
The new code uses memchr() to rapidly find a start point for memcmp().
In addition to knowing that the first character is a match, the new code
also checks that the last character is a match. This significantly reduces
the incidence of false starts (saving memcmp() calls and making quadratic
behavior less likely).
Improves the timings on:
python -m timeit -r7 -s"x='a'*1000" "'ab' in x"
python -m timeit -r7 -s"x='a'*1000" "'bc' in x"
Once this code has proven itself, then string_find_internal() should refer
to it rather than running its own version. Also, something similar may
apply to unicode objects.
|
| |
|
|
|
| |
_PyString_Resize() readied strings for mutation but did not invalidate
the cached hash value.
|
| |
|
|
|
|
|
|
|
| |
s.join([t]) is t
for (s, t) in (str, str), (unicode, unicode), and (str, unicode).
For (unicode, str), verify that it's *not* t (the result is promoted
to unicode instead). Also verify that when t is a subclass of str or
unicode that "the right thing" happens.
|
| |
|
|
|
|
| |
it can be used for str and unicode. Drop the test for
"".join([s]) is s
because this is an implementation detail (and doesn't work for unicode)
|
| |
|
|
|
|
|
|
|
|
|
|
| |
unicodedata.east_asian_width(). You can still implement your own
simple width() function using it like this:
def width(u):
w = 0
for c in unicodedata.normalize('NFC', u):
cwidth = unicodedata.east_asian_width(c)
if cwidth in ('W', 'F'): w += 2
else: w += 1
return w
|
| |
|
|
| |
addition to unicode objects.
|
| |
|
|
| |
separaters on str.split() and str.rsplit().
|
| |
|
|
| |
using specialized splitter for 1 char sep.
|
| |
|
|
|
| |
SF feature request #801847.
Original patch is written by Sean Reifschneider.
|
| | |
|
| |
|
|
|
|
| |
Adding missing support for '%F'.
Will backport to 2.3.1.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
* Doc - add doc for when functions were added
* UserString
* string object methods
* string module functions
'chars' is used for the last parameter everywhere.
These changes will be backported, since part of the changes
have already been made, but they were inconsistent.
|
| |
|
|
|
|
|
|
| |
instead of raising a TypeError. (From SF patch #710127)
Add tests to verify this is fixed.
Add various tests for '%c' % int.
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
between str, unicode, UserString and the string module
as possible. This increases code coverage in stringobject.c
from 83% to 86% and should help keep the string classes
in sync in the future. From SF patch #662807
|
| | |
|
| | |
|
| |
|
|
|
| |
the string/unicode method .replace() with a zero-lengt first argument.
Inyeol contributed tests for this too.
|
| |
|
|
|
| |
Closes SF Bug #592573 where inplace add mutated a UserString.
Added unittests to verify the bug is cleared.
|
| |
|
|
|
| |
rather than vereq(). While it was effectively testing regular strings, it
ignored the test() function argument when called by test_userstring.py.
|
| | |
|
| |
|
|
| |
string of longer than 1 character.
|
| |
|
|
|
|
|
|
| |
imports of test modules now import from the test package. Other
related oddities are also fixed (like DeprecationWarning filters that
weren't specifying the full import part, etc.). Also did a general
code cleanup to remove all "from test.test_support import *"'s. Other
from...import *'s weren't changed.
|
| |
|
|
| |
Handle negative indices similar to slices.
|