summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
Commit message (Collapse)AuthorAgeFilesLines
* Variation of patch # 1624059 to speed up checking if an object is a subclassNeal Norwitz2007-02-251-1/+1
| | | | | | | | | | | | | | | | | | of some of the common builtin types. Use a bit in tp_flags for each common builtin type. Check the bit to determine if any instance is a subclass of these common types. The check avoids a function call and O(n) search of the base classes. The check is done in the various Py*_Check macros rather than calling PyType_IsSubtype(). All the bits are set in tp_flags when the type is declared in the Objects/*object.c files because PyType_Ready() is not called for all the types. Should PyType_Ready() be called for all types? If so and the change is made, the changes to the Objects/*object.c files can be reverted (remove setting the tp_flags). Objects/typeobject.c would also have to be modified to add conditions for Py*_CheckExact() in addition to each the PyType_IsSubtype check.
* Forward-port of r52136,52138: a review of overflow-detecting code.Armin Rigo2006-10-041-2/+5
| | | | | | | | | | | | | | | | | | | | | | | * unified the way intobject, longobject and mystrtoul handle values around -sys.maxint-1. * in general, trying to entierely avoid overflows in any computation involving signed ints or longs is extremely involved. Fixed a few simple cases where a compiler might be too clever (but that's all guesswork). * more overflow checks against bad data in marshal.c. * 2.5 specific: fixed a number of places that were still confusing int and Py_ssize_t. Some of them could potentially have caused "real-world" breakage. * list.pop(x): fixing overflow issues on x was messy. I just reverted to PyArg_ParseTuple("n"), which does the right thing. (An obscure test was trying to give a Decimal to list.pop()... doesn't make sense any more IMHO) * trying to write a few tests...
* Fix endcase for str.rpartition()Raymond Hettinger2006-09-041-2/+2
|
* Patch #1541585: fix buffer overrun when performing repr() onNeal Norwitz2006-08-211-12/+29
| | | | | | a unicode string in a build with wide unicode (UCS-4) support. This code could be improved, so add an XXX comment.
* Correct an accidentally removed previous patch.Marc-André Lemburg2006-08-141-5/+2
|
* Slightly revised version of patch #1538956:Marc-André Lemburg2006-08-141-4/+83
| | | | | | | | | | Replace UnicodeDecodeErrors raised during == and != compares of Unicode and other objects with a new UnicodeWarning. All other comparisons continue to raise exceptions. Exceptions other than UnicodeDecodeErrors are also left untouched.
* Patch #1538606, Patch to fix __index__() clipping.Neal Norwitz2006-08-121-5/+2
| | | | | | | I modified this patch some by fixing style, some error checking, and adding XXX comments. This patch requires review and some changes are to be expected. I'm checking in now to get the greatest possible review and establish a baseline for moving forward. I don't want this to hold up release if possible.
* Handle allocation failures gracefully. Found with failmalloc.Neal Norwitz2006-07-211-0/+3
| | | | Many (all?) of these could be backported.
* Patch #1455898: Incremental mode for "mbcs" codec.Martin v. Löwis2006-06-141-39/+175
|
* Initialize the type object so pychecker can't crash the interpreter.Neal Norwitz2006-06-131-0/+2
|
* Apply perky's fix for #1503157: "/".join([u"", u""]) raising OverflowError.Georg Brandl2006-06-101-3/+3
| | | | Also improve error message on overflow.
* RFE #1491485: str/unicode.endswith()/startswith() now accept a tuple as ↵Georg Brandl2006-06-091-20/+50
| | | | first argument.
* Repair refleaks in unicodeobject.Georg Brandl2006-06-041-0/+3
|
* Patch #1359618: Speed-up charmap encoder.Martin v. Löwis2006-06-041-49/+285
|
* needforspeed: stringlib refactoring: changed find_obj to find_slice,Fredrik Lundh2006-05-271-18/+30
| | | | to enable use from stringobject
* needforspeed: replace improvements, changed to Py_LOCAL_INLINEFredrik Lundh2006-05-271-16/+30
| | | | where appropriate
* Revert bogus change committed in 46432 to this file.Martin v. Löwis2006-05-271-1/+0
|
* fixed typoAndrew Dalke2006-05-271-1/+1
|
* needforspeed: more stringlib refactoringFredrik Lundh2006-05-271-92/+60
|
* Patch 1494554: Update numeric properties to Unicode 4.1.Martin v. Löwis2006-05-271-0/+1
|
* Fix Coverity warnings.Neal Norwitz2006-05-271-1/+1
| | | | | - Check the correct variable (str_obj, not str) for NULL - sep_len was already verified it wasn't 0
* Comment typoAndrew M. Kuchling2006-05-261-1/+1
|
* needforspeed: stringlib refactoring: use stringlib/find for string findFredrik Lundh2006-05-261-5/+4
|
* needforspeed: use a macro to fix slice indexesFredrik Lundh2006-05-261-52/+18
|
* needforspeed: stringlib refactoring: use stringlib/find for unicodeFredrik Lundh2006-05-261-14/+36
| | | | find
* needforspeed: stringlib refactoring, continued. added count andFredrik Lundh2006-05-261-47/+35
| | | | find helpers; updated unicodeobject to use stringlib_count
* needspeed: rpartition documentation, tests, and a bug fixes.Fredrik Lundh2006-05-261-2/+2
| | | | feel free to add more tests and improve the documentation.
* needforspeed: added rpartition implementationFredrik Lundh2006-05-261-0/+50
|
* needforspeed: stringlib refactoring (in progress)Fredrik Lundh2006-05-261-43/+16
|
* needforspeed: stringlib refactoring (in progress)Fredrik Lundh2006-05-261-87/+2
|
* use Py_LOCAL also for string and unicode objectsFredrik Lundh2006-05-261-22/+10
|
* needforspeed: use Py_ssize_t for the fastsearch counter and skipFredrik Lundh2006-05-261-1/+1
| | | | | length (thanks, neal!). and yes, I've verified that this doesn't slow things down ;-)
* needforspeed: use METH_O for argument handling, which made partition someFredrik Lundh2006-05-261-7/+2
| | | | | ~15% faster for the current tests (which is noticable faster than a corre- sponding find call). thanks to neal-who-never-sleeps for the tip.
* needforspeed: partition implementation, part two.Fredrik Lundh2006-05-261-63/+96
| | | | feel free to improve the documentation and the docstrings.
* Code had returned an ssize_t, upcast to long, then converted with ↵Andrew Dalke2006-05-251-1/+1
| | | | | | PyInt_FromLong. Now using PyInt_FromSsize_t.
* needforspeed: check for overflow in replace (from Andrew Dalke)Fredrik Lundh2006-05-251-4/+25
|
* needforspeed: refactored the replace code slightly; special-caseFredrik Lundh2006-05-241-84/+86
| | | | constant-length changes; use fastsearch to locate the first match.
* needforspeedindeed: use fastsearch also for __contains__Fredrik Lundh2006-05-241-4/+19
|
* needforspeed: use "fastsearch" for count and findstring helpers. thisFredrik Lundh2006-05-241-1/+109
| | | | | | | | | | | | | | results in a 2.5x speedup on the stringbench count tests, and a 20x (!) speedup on the stringbench search/find/contains test, compared to 2.5a2. for more on the algorithm, see: http://effbot.org/zone/stringlib.htm if you get weird results, you can disable the new algoritm by undefining USE_FAST in Objects/unicodeobject.c. enjoy /F
* use Py_ssize_t for string indexes (thanks, neal!)Fredrik Lundh2006-05-241-2/+2
|
* return 0 on misses, not -1.Fredrik Lundh2006-05-231-1/+1
|
* needforspeed: use append+reverse for rsplit, use "bloom filters" toFredrik Lundh2006-05-231-43/+101
| | | | | | | speed up splitlines and strip with charsets; etc. rsplit is now as fast as split in all our tests (reverse takes no time at all), and splitlines() is nearly as fast as a plain split("\n") in our tests. and we're not done yet... ;-)
* needforspeed: fixed unicode "in" operator to use same implementationFredrik Lundh2006-05-231-27/+29
| | | | approach as find/index
* unicode_repeat(): Change type of local to Py_ssize_t,Tim Peters2006-05-231-1/+1
| | | | since that's what it should be.
* PyUnicode_Join(): Recent code changes introduced newTim Peters2006-05-221-9/+8
| | | | | | | | compiler warnings on Windows (signed vs unsigned mismatch in comparisons). Cleaned that up by switching more locals to Py_ssize_t. Simplified overflow checking (it can _be_ simpler because while these things are declared as Py_ssize_t, then should in fact never be negative).
* needforspeed: use memcpy for "long" strings; use a better algorithmFredrik Lundh2006-05-221-4/+11
| | | | for long repeats.
* needforspeed: speed up unicode repeat, unicode string copyFredrik Lundh2006-05-221-4/+7
|
* docstring tweaks: count counts non-overlapping substrings, notFredrik Lundh2006-05-221-2/+2
| | | | total number of occurences
* Patch #1488312, Fix memory alignment problem on SPARC in unicode. Will backportNeal Norwitz2006-05-151-1/+1
|
* Use %zd instead of %i as format character (in call to PyErr_Format) forThomas Wouters2006-04-161-1/+1
| | | | Py_ssize_t argument.