summaryrefslogtreecommitdiffstats
path: root/Objects/stringobject.c
Commit message (Collapse)AuthorAgeFilesLines
* string_join(): Some cleaning up of reference counting. In theBarry Warsaw2000-07-111-7/+10
| | | | | | | | seqlen==1 clause, before returning item, we need to DECREF seq. In the res=PyString... failure clause, we need to goto finally to also decref seq (and the DECREF of res in finally is changed to a XDECREF). Also, we need to DECREF seq just before the PyUnicode_Join() return.
* fix two refcount bugs in new string_join implementation:Jeremy Hylton2000-07-111-6/+2
| | | | | 1. PySequence_Fast_GET_ITEM is a macro and borrows a reference 2. The seq returned from PySequence_Fast must be decref'd
* two changes to string_join:Jeremy Hylton2000-07-101-82/+42
| | | | | | implementation -- use PySequence_Fast interface to iterate over elements interface -- if instance object reports wrong length, ignore it; previous version raised an IndexError if reported length was too high
* Somebody started playing with const, so of course the outcomeTim Peters2000-07-091-8/+8
| | | | | | | | | | | | | was cascades of warnings about mismatching const decls. Overall, I think const creates lots of headaches and solves almost nothing. Added enough consts to shut up the warnings, but this did require casting away const in one spot too (another usual outcome of starting down this path): the function mymemreplace can't return const char*, but sometimes wants to return its first argument as-is, which latter must be declared const char* in order to avoid const warnings at mymemreplace's call sites. So, in the case the function wants to return the first arg, that arg's declared constness must be subverted.
* ANSI-fication of the sources.Fred Drake2000-07-091-187/+76
|
* Added new codec APIs and a new interface method .encode() whichMarc-André Lemburg2000-07-061-0/+114
| | | | | | | | | works just like the Unicode one. The C APIs match the ones in the Unicode implementation, but were extended to be able to reuse the existing Unicode codecs for string purposes too. Conversions from string to Unicode and back are done using the default encoding.
* Added new .isalpha() and .isalnum() methods to match the sameMarc-André Lemburg2000-07-051-0/+68
| | | | | ones on the Unicode objects. Note that the string versions use the (locale aware) C lib APIs isalpha() and isalnum().
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|
* Marc-Andre Lemburg <mal@lemburg.com>:Marc-André Lemburg2000-06-301-26/+68
| | | | | | New buffer overflow checks for formatting strings. By Trent Mick.
* Fredrik Lundh <effbot@telia.com>:Fred Drake2000-06-201-8/+4
| | | | | Simplify find code; this is a performance improvement on at least some platforms.
* Marc-Andre Lemburg <mal@lemburg.com>:Marc-André Lemburg2000-06-141-0/+20
| | | | Added code so that .isXXX() testing returns 0 for emtpy strings.
* Patch from Michael Hudson: improve unclear error messageAndrew M. Kuchling2000-06-091-1/+1
|
* Michael Hudson <mwh21@cam.ac.uk>:Fred Drake2000-06-011-1/+3
| | | | | Removed PyErr_BadArgument() calls and replaced them with more useful error messages.
* Trent Mick:Guido van Rossum2000-05-081-5/+9
| | | | | | | | | | | | | | | | Fix the string methods that implement slice-like semantics with optional args (count, find, endswith, etc.) to properly handle indeces outside [INT_MIN, INT_MAX]. Previously the "i" formatter for PyArg_ParseTuple was used to get the indices. These could overflow. This patch changes the string methods to use the "O&" formatter with the slice_index() function from ceval.c which is used to do the same job for Python code slices (e.g. 'abcabcabc'[0:1000000000L]). slice_index() is renamed _PyEval_SliceIndex() and is now exported. As well, the return values for success/fail were changed to make slice_index directly usable as required by the "O&" formatter. [GvR: shouldn't a similar patch be applied to unicodeobject.c?]
* The methods islower(), isupper(), isspace(), isdigit() and istitle()Guido van Rossum2000-05-051-11/+11
| | | | | | gave bogus results for chars in the range 128-255, because their implementation was using signed characters. Fixed this by using unsigned character pointers (as opposed to using Py_CHARMASK()).
* Vladimir Marangozov's long-awaited malloc restructuring.Guido van Rossum2000-05-031-21/+19
| | | | | | | | | | For more comments, read the patches@python.org archives. For documentation read the comments in mymalloc.h and objimpl.h. (This is not exactly what Vladimir posted to the patches list; I've made a few changes, and Vladimir sent me a fix in private email for a problem that only occurs in debug mode. I'm also holding back on his change to main.c, which seems unnecessary to me.)
* Marc-Andre Lemburg:Guido van Rossum2000-04-111-11/+14
| | | | | | | | | The maxsplit functionality in .splitlines() was replaced by the keepends functionality which allows keeping the line end markers together with the string. Added support for '%r' % obj: this inserts repr(obj) rather than str(obj).
* Marc-Andre Lemburg:Guido van Rossum2000-04-101-3/+52
| | | | | | | | | | | | | * string_contains now calls PyUnicode_Contains() only when the other operand is a Unicode string (not whenever it's not a string). * New format style '%r' inserts repr(arg) instead of str(arg). * '...%s...' % u"abc" now coerces to Unicode just like string methods. Care is taken not to reevaluate already formatted arguments -- only the first Unicode object appearing in the argument mapping is looked up twice. Added test cases for this to test_unicode.py.
* On 17-Mar-2000, Marc-Andre Lemburg said:Barry Warsaw2000-03-201-2/+2
| | | | | | | | | | | | | Attached you find an update of the Unicode implementation. The patch is against the current CVS version. I would appreciate if someone with CVS checkin permissions could check the changes in. The patch contains all bugs and patches sent this week and also fixes a leak in the codecs code and a bug in the free list code for Unicode objects (which only shows up when compiling Python with Py_DEBUG; thanks to MarkH for spotting this one).
* Fix typo in replace() detected by Mark Hammond and fixed by Marc-Andre.Guido van Rossum2000-03-131-2/+4
|
* Many changes for Unicode, by Marc-Andre Lemburg.Guido van Rossum2000-03-101-162/+755
|
* Patch by Moshe Zadka: move the string special case from abstract.cGuido van Rossum2000-03-071-0/+22
| | | | | | here. [Patch modified by GvR to keep the original exception.]
* string_join(): Fix memory leaks discovered by Charles Waldman (and aBarry Warsaw2000-03-061-5/+15
| | | | few other paths through the function that leaked).
* Massive patch by Skip Montanaro to add ":name" to as manyGuido van Rossum2000-02-291-14/+14
| | | | PyArg_ParseTuple() format string arguments as possible.
* The rest of the changes by Trent Mick and Dale Nagata for warning-freeGuido van Rossum2000-01-201-4/+4
| | | | compilation on NT Alpha. Mostly added casts etc.
* do_strip(): Fixed cut-and-paste error; this function should check forBarry Warsaw1999-12-151-3/+1
| | | | zero arguments (found by Marc Lemburg).
* Mainlining the string_methods branch. See branch revision logBarry Warsaw1999-10-121-1/+1044
| | | | messages for specific changes.
* Fix bug discovered by John W. Shipman -- when the width of a formatGuido van Rossum1999-06-071-2/+4
| | | | | | | | specifier came from an int expression instead of a constant in the format, a negative width was truncated to zero instead of taken to mean the same as that negative constant plugged into the format. E.g. "(%*s)" % (-5, "foo") yielded "(foo)" while "(%-5s)" yields "(foo )". Now both yield the latter -- like sprintf() in C.
* Greg Stein: Implement the new bf_getcharbuffer function, indicatingGuido van Rossum1998-10-081-2/+18
| | | | that (as far as the data type is concerned!) this is character data.
* Typo reported by Greg Stein: "modifiable" is the correct spelling.Guido van Rossum1998-10-011-1/+1
|
* Should check that PyObject_Str() really returned a string!Guido van Rossum1998-06-091-0/+5
|
* Make new gcc -Wall happyGuido van Rossum1998-04-101-2/+4
|
* Patch submitted by Brad Howes (with one bug fixed by me): allowGuido van Rossum1997-09-081-8/+17
| | | | | | arbitrary nested parens in a %(...)X style format. #Also folded two lines and added more detail to the error message for #unsupported format character.
* Change the Fini function to only remove otherwise unreferenced stringsGuido van Rossum1997-08-051-6/+16
| | | | | | | | | | from the interned table. There are references in hard-to-find static variables all over the interpreter, and it's not worth trying to get rid of all those; but "uninterning" isn't fair either and may cause subtle failures later -- so we have to keep them in the interned table. Also get rid of no-longer-needed insert of None in interned dict.
* Added internal routine PyString_Fini() which deletes all internedGuido van Rossum1997-08-021-0/+18
| | | | strings. For use in Py_Finalize() only.
* Use #include "mymath.h" instead of declaring fabs() explicitly.Guido van Rossum1997-06-031-2/+1
| | | | This should solve a weird problem on the Mac for Jack.
* Checkin of Jack's buffer mods.Guido van Rossum1997-05-051-1/+41
| | | | Not really checked, but didn't fail any tests either...
* Quickly renamed the last directory.Guido van Rossum1997-05-021-190/+203
|
* Tweaks to keep the Microsoft compiler quiet.Guido van Rossum1997-04-091-1/+1
|
* Slight tweak: in string_hash(), if the hash hasn't been computed yet,Guido van Rossum1997-02-141-0/+5
| | | | | and if there's a pointer to an interned version of the string, use its hash and store its hash in this object, rather than recomputing it.
* Fix bug reported by Per Lindqvist: "%#06x" % 1 stuck the 0 paddingGuido van Rossum1997-01-291-1/+13
| | | | in front of the 0x, like such: "0000x1".
* Don't use static buffers internally for formatstring().Guido van Rossum1997-01-211-25/+26
|
* String interning.Guido van Rossum1997-01-181-0/+75
|
* Add const to error and newstring functionsGuido van Rossum1996-12-101-2/+2
|
* Make gcc -Wall happyGuido van Rossum1996-12-051-2/+2
|
* New permission notice, includes CNRI.Guido van Rossum1996-10-251-13/+20
|
* Fixed compare function to do first char comparison in unsigned mode,Guido van Rossum1996-10-231-1/+1
| | | | for consistency with the way other characters are compared.
* Multiply by 1000003 instead of 3 in string hachGuido van Rossum1996-09-111-1/+1
|
* new debugger symbol namesGuido van Rossum1996-05-231-1/+1
|