summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix the overflows in expandtabs(). "This time for sure!"Guido van Rossum2008-03-111-25/+33
| | | | (Exploit at request.)
* Issue 1742669. Now %d accepts very big float numbers.Facundo Batista2008-02-241-13/+42
| | | | Thanks Gabriel Genellina.
* Backport of PEP 3101, Advanced String Formatting, from py3k.Eric Smith2008-02-171-14/+20
| | | | | | | | | | | | | | | Highlights: - Adding PyObject_Format. - Adding string.Format class. - Adding __format__ for str, unicode, int, long, float, datetime. - Adding builtin format. - Adding ''.format and u''.format. - str/unicode fixups for formatters. The files in Objects/stringlib that implement PEP 3101 (stringdefs.h, unicodedefs.h, formatter.h, string_format.h) are identical in trunk and py3k. Any changes from here on should be made to trunk, and changes will propogate to py3k).
* Implemented Martin's suggestion to clear the free lists during the garbage ↵Christian Heimes2008-02-141-12/+21
| | | | collection of the highest generation.
* Unified naming convention for free lists and their limits. All free listsChristian Heimes2008-02-061-20/+20
| | | | | | | | in Object/ are named ``free_list``, the counter ``numfree`` and the upper limit is a macro ``PyName_MAXFREELIST`` inside an #ifndef block. The chances should make it easier to adjust Python for platforms with less memory, e.g. mobile phones.
* Patch #1970 by Antoine Pitrou: Speedup unicode whitespace and linebreak ↵Christian Heimes2008-01-301-18/+81
| | | | detection. The speedup is about 25% for split() (571 / 457 usec) and 35% (175 / 127 usec )for splitlines()
* Backport of several functions from Python 3.0 to 2.6 including ↵Christian Heimes2008-01-251-0/+465
| | | | | | | PyUnicode_FromString, PyUnicode_Format and PyLong_From/AsSsize_t. The functions are partly required for the backport of the bytearray type and _fileio module. They should also make it easier to port C to 3.0. First chapter of the Python 3.0 io framework back port: _fileio The next step depends on a working bytearray type which itself depends on a backport of the nwe buffer API.
* Modified PyImport_Import and PyImport_ImportModule to always use absolute ↵Christian Heimes2008-01-031-1/+1
| | | | | | imports by calling __import__ with an explicit level of 0 Added a new API function PyImport_ImportModuleNoBlock. It solves the problem with dead locks when mixing threads and imports
* #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and ↵Christian Heimes2007-12-191-11/+11
| | | | Py_REFCNT. Macros for b/w compatibility are available.
* The incremental decoder for utf-7 must preserve its state between calls.Amaury Forgeot d'Arc2007-11-201-2/+19
| | | | | | | Solves issue1460. Might not be a backport candidate: a new API function was added, and some code may rely on details in utf-7.py.
* Made _ParseTupleFinds only defined to unicodeobject.cFacundo Batista2007-11-161-0/+1
|
* Now in find, rfind, index, and rindex, you can use None as defaults,Facundo Batista2007-11-161-30/+14
| | | | | | | | | | | | as usual with slicing (both with str and unicode strings). This fixes issue 1259. For str only the stringobject.c file was modified. But for unicode, I needed to repeat in the four functions a lot of code, so created a new function that does part of the job for them (and placed it in find.h, following a suggestion of Barry). Also added tests for this behaviour.
* Backport fixes for the code that decodes octal escapes (and for PyStringGuido van Rossum2007-10-291-3/+6
| | | | | | | also hex escapes) -- this was reaching beyond the end of the input string buffer, even though it is not supposed to be \0-terminated. This has no visible effect but is clearly the correct thing to do. (In 3.0 it had a visible effect after removing ob_sstate from PyString.)
* Set startinpos before calling the error handler.Walter Dörwald2007-08-301-0/+1
|
* Rewrap line.Walter Dörwald2007-08-301-1/+2
|
* Improve extended slicing support in builtin types and classes. Specifically:Thomas Wouters2007-08-281-0/+6
| | | | | | | | | | | | | | | | | | | | - Specialcase extended slices that amount to a shallow copy the same way as is done for simple slices, in the tuple, string and unicode case. - Specialcase step-1 extended slices to optimize the common case for all involved types. - For lists, allow extended slice assignment of differing lengths as long as the step is 1. (Previously, 'l[:2:1] = []' failed even though 'l[:2] = []' and 'l[:2:None] = []' do not.) - Implement extended slicing for buffer, array, structseq, mmap and UserString.UserString. - Implement slice-object support (but not non-step-1 slice assignment) for UserString.MutableString. - Add tests for all new functionality.
* Move another variable declaration up.Walter Dörwald2007-08-171-2/+2
|
* Move variable declaration up.Walter Dörwald2007-08-171-6/+6
|
* Backport r57105 and r57145 from the py3k branch: UTF-32 codecs.Walter Dörwald2007-08-171-0/+266
|
* Bug #1763149: use proper slice syntax in docstring.Georg Brandl2007-07-291-2/+2
| | | | (backport)
* PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis2007-07-211-15/+13
| | | | | backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
* Patch #1673759: add a missing overflow check when formatting floatsGeorg Brandl2007-07-121-1/+2
| | | | with %G.
* Fix a bug when there was a newline in the string expandtabs was called on.Neal Norwitz2007-06-111-2/+8
| | | | | | This also catches another condition that can overflow. Will backport.
* Prevent expandtabs() on string and unicode objects from causing a segfault whenNeal Norwitz2007-06-091-3/+14
| | | | | | | a large width is passed on 32-bit platforms. Found by Google. It would be good for people to review this especially carefully and verify I don't have an off by one error and there is no other way to cause overflow.
* 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