| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
| |
|
| |
|
|
|
|
| |
related tests are now about 10x faster.
|
|
|
|
|
| |
new string is over max Py_ssize_t. I have no way to test it on my
box or any box I have access to. At least it doesn't break anything.
|
| |
|
|
|
|
| |
for the related stringbench tests.
|
|
|
|
|
|
|
|
|
|
|
| |
made a copy of the string using PyString_FromStringAndSize(s, n) and modify
the copied string in-place. However, 1 (and 0) character strings are shared
from a cache. This cause "A".replace("A", "a") to change the cached version
of "A" -- used by everyone.
Now may the copy with NULL as the string and do the memcpy manually. I've
added regression tests to check if this happens in the future. Perhaps
there should be a PyString_Copy for this case?
|
|
|
|
|
| |
now about 3x faster on my machine, for the replace tests from string-
bench.
|
| |
|
|
|
|
| |
versions if they're not defined.
|
|
|
|
|
| |
strings too... (thanks to georg brandl for spotting the exact problem
faster than anyone else)
|
|
|
|
|
|
|
| |
(the unicode versions of these are still 2x faster on windows,
though...)
based on work by Andrew Dalke, with tweaks by yours truly.
|
|
|
|
| |
total number of occurences
|
|
|
|
|
|
|
|
|
|
|
|
| |
about "%u", "%lu" and "%zu" formats.
Since PyString_FromFormat and PyErr_Format have exactly the same rules
(both inherited from PyString_FromFormatV), it would be good if someone
with more LaTeX Fu changed one of them to just point to the other.
Their docs were way out of synch before this patch, and I just did a
mass copy+paste to repair that.
Not a backport candidate (this is a new feature).
|
| |
|
|
|
|
| |
string, because of a cast to int.
|
| |
|
|
|
|
|
|
| |
zfill stringmethods, so they can create strings larger than 2Gb on 64bit
systems (even win64.) The unicode versions of these methods already did this
right.
|
|
|
|
| |
a couple places
|
| |
|
|
|
|
| |
PyObject_CallMethod aware of PY_SSIZE_T_CLEAN.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
solution) in the same way as listobject.c got changed. Hoping for a better
solution.
|
|
|
|
| |
Can probably be backported if anyone cares.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
This will hopefully get rid of some Coverity warnings, be a hint to
developers, and be marginally faster.
Some asserts were added when the type is currently known, but depends
on values from another function.
|
|
|
|
|
| |
in pyport.h. Changed PyString_FromFormatV() to use it
instead of inlining its own maze of #if'ery.
|
|
|
|
|
|
| |
This was mostly written by Travis Oliphant.
I've inspected it all; Neal Norwitz and MvL have also looked at it
(in an earlier incarnation).
|
|
|
|
| |
(reviewed by Neal Norwitz)
|
|
|
|
|
| |
Add (int) casts to silence compiler warnings.
Raise Python exceptions for overflows.
|
| |
|
| |
|
|
|
|
| |
Convert Py_ssize_t using PyInt_FromSsize_t
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In C++, it's an error to pass a string literal to a char* function
without a const_cast(). Rather than require every C++ extension
module to put a cast around string literals, fix the API to state the
const-ness.
I focused on parts of the API where people usually pass literals:
PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type
slots, etc. Predictably, there were a large set of functions that
needed to be fixed as a result of these changes. The most pervasive
change was to make the keyword args list passed to
PyArg_ParseTupleAndKewords() to be a const char *kwlist[].
One cast was required as a result of the changes: A type object
mallocs the memory for its tp_doc slot and later frees it.
PyTypeObject says that tp_doc is const char *; but if the type was
created by type_new(), we know it is safe to cast to char *.
|
|
|
|
|
|
|
|
| |
[ 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.
|
|
|
|
| |
Will backport
|
|
|
|
| |
enabled.
|
|
|
|
|
| |
subclasses should be substituted as-is and not have tp_str called on
them.
|
|
|
|
|
| |
unicode instance if the argument is not an instance of basestring and
calling __str__ on the argument returns a unicode instance.
|
|
|
|
| |
Hex longs now print with lowercase letters like their int counterparts.
|
|
|
|
| |
* 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.
|
|
|
|
| |
This should go on whatever bugfix branches the other fetches up on.
|
|
|
|
|
| |
_PyString_Resize() readied strings for mutation but did not invalidate
the cached hash value.
|