summaryrefslogtreecommitdiff
path: root/Objects/unicodeobject.c
AgeCommit message (Collapse)AuthorLines
2006-10-23patch for PSF-2006-001.Anthony Baxter-12/+25
2004-02-05Backport checkin:Walter Dörwald-1/+1
Fix reallocation bug in unicode.translate(): The code was comparing characters instead of character pointers to determine space requirements.
2003-10-24Backport checkin:Walter Dörwald-19/+20
Fix a bug in the memory reallocation code of PyUnicode_TranslateCharmap(). charmaptranslate_makespace() allocates more memory than required for the next replacement but didn't remember that fact, so memory size was growing exponentially every time a replacement string is longer that one character. This fixes SF bug #828737.
2003-10-18Patch #825679: Clarify semantics of .isfoo on empty strings.Martin v. Löwis-10/+11
2003-09-17Backport Tim's portability improvement and comments.Jeremy Hylton-1/+13
2003-09-16Backport: Double-fix of crash in Unicode freelist handling.Jeremy Hylton-1/+2
2003-08-27SF bug #795506: Wrong handling of string format code for float values.Raymond Hettinger-0/+3
Added missing support for '%F' as had been documented.
2003-08-15Backport checkin:Walter Dörwald-0/+1
Fix refcounting leak in charmaptranslate_lookup()
2003-08-15Backport checkin:Walter Dörwald-1/+3
Fix another refcounting leak in PyUnicode_EncodeCharmap().
2003-08-15Backport checkin:Walter Dörwald-0/+2
Fix another refcounting leak (in PyUnicode_DecodeUnicodeEscape()).
2003-08-14Backport checkins:Walter Dörwald-3/+3
Fix refcount leak in PyUnicode_EncodeCharmap(). The bug surfaces when an encoding error occurs and the callback name is unknown, i.e. when the callback has to be called. The problem was that the fact that the callback has already been looked up was only recorded in a local variable in charmap_encoding_error(), because charmap_encoding_error() got it's own copy of the errorHandler pointer instead of a pointer to the pointer in PyUnicode_EncodeCharmap().
2003-07-01Support 'mbcs' as a 'built-in' encoding, so the C API can use it withoutMark Hammond-0/+19
defering to the encodings package. As described in [ 763111 ] mbcs encoding should skip encodings package
2003-06-28SF patch 703666: Several objects don't decref tmp on failure in subtype_newRaymond Hettinger-1/+4
Submitted By: Christopher A. Craig Fillin some missing decrefs.
2003-05-18Consider \U-escapes in raw-unicode-escape. Fixes #444514.Martin v. Löwis-3/+42
2003-04-10Attempt to make all the various string *strip methods the same.Neal Norwitz-9/+9
* 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.
2003-04-09Reformat a few docstrings that caused line wraps in help() output.Guido van Rossum-6/+6
2003-04-02Change formatchar(), so that u"%c" % 0xffffffff now raisesWalter Dörwald-2/+2
an OverflowError instead of a TypeError to be consistent with "%c" % 256. See SF patch #710127.
2003-03-09Sf patch #700047: unicode object leaks refcount on resizingRaymond Hettinger-0/+1
Contributed by Hye-Shik Chang.
2003-02-11Add more missing PyErr_NoMemory() after failled memory allocsNeal Norwitz-1/+1
2003-02-09Fix two refcounting bugsWalter Dörwald-2/+4
2003-01-31Change the treatment of positions returned by PEP293Walter Dörwald-9/+17
error handers in the Unicode codecs: Negative positions are treated as being relative to the end of the input and out of bounds positions result in an IndexError. Also update the PEP and include an explanation of this in the documentation for codecs.register_error. Fixes a small bug in iconv_codecs: if the position from the callback is negative *add* it to the size instead of substracting it. From SF patch #677429.
2003-01-29Implement appropriate __getnewargs__ for all immutable subclassable builtinGuido van Rossum-0/+9
types. The special handling for these can now be removed from save_newobj(). Add some testing for this. Also add support for setting the 'fast' flag on the Python Pickler class, which suppresses use of the memo.
2003-01-08Fix charmapencode_lookup(), so that a None value in the mappingWalter Dörwald-0/+2
is treated as "character maps to <undefined>" and not as "character mapping must return integer, None or str".
2003-01-08Remove variable owned from PyUnicode_FromEncodedObject, which is unusedWalter Dörwald-7/+0
(except for Py_DECREF calls) since the introduction of __unicode__.
2002-12-29Patch for bug #659709: bogus computation of float lengthMarc-André Lemburg-10/+21
Python 2.2.x backport candidate. (This bug has been around since Python 1.6.)
2002-11-18Add nb_remainder (i.e. __mod__) slot to unicode type. Fixes SF bug #615506.Neil Schemenauer-2/+21
2002-11-12Fix SF # 635969, No error "not all arguments converted"Neal Norwitz-1/+2
When mwh added extended slicing, strings and unicode became mappings. Thus, dict was set which prevented an error when doing: newstr = 'format without a percent' % string_value This fix raises an exception again when there are no formats and % with a string value.
2002-10-23Fix for bug #626172: crash using unicode latin1 single charMarc-André Lemburg-3/+1
Python 2.2.3 candidate.
2002-10-11Fix a nasty endcase reported by Armin Rigo in SF bug 618623:Guido van Rossum-2/+6
'%2147483647d' % -123 segfaults. This was because an integer overflow in a comparison caused the string resize to be skipped. After fixing the overflow, this could call _PyString_Resize() with a negative size, so I (1) test for that and raise MemoryError instead; (2) also added a test for negative newsize to _PyString_Resize(), raising SystemError as for all bad arguments. An identical bug existed in unicodeobject.c, of course. Will backport to 2.2.2.
2002-09-24Add cast to avoid compiler warning.Marc-André Lemburg-1/+1
2002-09-13Fix part of SF bug # 544248 gcc warning in unicodeobject.cNeal Norwitz-1/+1
When --enable-unicode=ucs4, need to cast Py_UNICODE to a char
2002-09-12Fix warnings on 64-bit platforms about casts from pointers to ints.Guido van Rossum-1/+2
Two of these were real bugs.
2002-09-04Change the unicode.translate docstring to document thatWalter Dörwald-2/+3
Unicode strings (with arbitrary length) are allowed as entries in the unicode.translate mapping. Add a test case for multicharacter replacements. (Multicharacter replacements were enabled by the PEP 293 patch)
2002-09-02PEP 293 implemention (from SF patch http://www.python.org/sf/432401)Walter Dörwald-544/+1232
2002-08-23Fix SF bug 599128, submitted by Inyeol Lee: .replace() would do theGuido van Rossum-3/+9
wrong thing for a unicode subclass when there were zero string replacements. The example given in the SF bug report was only one way to trigger this; replacing a string of length >= 2 that's not found is another. The code would actually write outside allocated memory if replacement string was longer than the search string. (I wonder how many more of these are lurking? The unicode code base is full of wonders.) Bugfix candidate; this same bug is present in 2.2.1.
2002-08-23Code by Inyeol Lee, submitted to SF bug 595350, to implementGuido van Rossum-14/+20
the string/unicode method .replace() with a zero-lengt first argument. Inyeol contributed tests for this too.
2002-08-20Fix some endcase bugs in unicode rfind()/rindex() and endswith().Guido van Rossum-3/+3
These were reported and fixed by Inyeol Lee in SF bug 595350. The endswith() bug was already fixed in 2.3, but this adds some more test cases.
2002-08-14More changes of DeprecationWarning to FutureWarning.Guido van Rossum-1/+1
2002-08-11Add C API PyUnicode_FromOrdinal() which exposes unichr() at C level.Marc-André Lemburg-1/+55
u'%c' will now raise a ValueError in case the argument is an integer outside the valid range of Unicode code point ordinals. Closes SF bug #593581.
2002-08-11Implement stage B0 of PEP 237: add warnings for operations thatGuido van Rossum-0/+10
currently return inconsistent results for ints and longs; in particular: hex/oct/%u/%o/%x/%X of negative short ints, and x<<n that either loses bits or changes sign. (No warnings for repr() of a long, though that will also change to lose the trailing 'L' eventually.) This introduces some warnings in the test suite; I'll take care of those later.
2002-08-09Unicode replace() method with empty pattern argument should fail, likeGuido van Rossum-0/+5
it does for 8-bit strings.
2002-08-06PyUnicode_Contains(): The memcmp() call didn't take into account theBarry Warsaw-1/+1
width of Py_UNICODE. Good catch, MAL.
2002-08-06Committing patch #591250 which provides "str1 in str2" when str1 is aBarry Warsaw-17/+23
string of longer than 1 character.
2002-07-26tighten up the unicode object's docstring a tadSkip Montanaro-2/+2
2002-07-17staticforward bites the dust.Jeremy Hylton-1/+1
The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation.
2002-06-30Patch #569753: Remove support for WIN16.Martin v. Löwis-3/+3
Rename all occurrences of MS_WIN32 to MS_WINDOWS.
2002-06-13Fix typo in exception messageNeal Norwitz-1/+1
2002-06-13Patch #568124: Add doc string macros.Martin v. Löwis-74/+74
2002-06-11This is my nearly two year old patchMichael W. Hudson-2/+54
[ 400998 ] experimental support for extended slicing on lists somewhat spruced up and better tested than it was when I wrote it. Includes docs & tests. The whatsnew section needs expanding, and arrays should support extended slices -- later.
2002-05-29Fix a possible segfault. Found be Neal Norvitz.Marc-André Lemburg-1/+1