summaryrefslogtreecommitdiffstats
path: root/Objects/stringobject.c
Commit message (Collapse)AuthorAgeFilesLines
* #7116: str.join() takes an iterable.Georg Brandl2009-10-141-2/+2
|
* add keyword arguments support to str/unicode encode and decode #6300Benjamin Peterson2009-09-181-6/+10
|
* use macrosBenjamin Peterson2009-09-171-1/+1
|
* Silence gcc 'comparison always false' warningMark Dickinson2009-08-281-1/+3
|
* Issue #5835, deprecate PyOS_ascii_formatd.Eric Smith2009-04-251-7/+2
| | | | | | If anyone wants to clean up the documentation, feel free. It's my first documentation foray, and it's not that great. Will port to py3k with a different strategy.
* Issue #532631: Add paranoid check to avoid potential buffer overflowMark Dickinson2009-03-291-1/+10
| | | | on systems with sizeof(int) > 4.
* Issue #532631: Replace confusing fabs(x)/1e25 >= 1e25 testMark Dickinson2009-03-291-1/+1
| | | | with fabs(x) >= 1e50, and fix documentation.
* Issue #4850: Change COUNT_ALLOCS variables to Py_ssize_t.Martin v. Löwis2009-01-071-1/+1
|
* Issue #4445: save 3 bytes (on average, on a typical machine) perMark Dickinson2008-12-051-13/+21
| | | | string allocation.
* Docstring change for *partition: use same tense as other docstrings.Andrew M. Kuchling2008-10-041-7/+7
| | | | | Hyphenate left- and right-justified. Fix 'registerd' typo
* Issue #3751: str.rpartition would perform a left-partition when called withAmaury Forgeot d'Arc2008-09-011-1/+1
| | | | | | a unicode argument. will backport.
* Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple,Martin v. Löwis2008-08-121-3/+4
| | | | | | | by denying s# to parse objects that have a releasebuffer procedure, and introducing s*. More module might need to get converted to use s*.
* Preemptively backport the relevant parts of r65420Antoine Pitrou2008-08-021-1/+1
|
* Security patches from Apple: prevent int overflow when allocating memoryNeal Norwitz2008-07-311-2/+17
|
* Backed out r65069, pending fixing it in Windows.Eric Smith2008-07-171-8/+5
|
* Issue 3382: Make '%F' and float.__format__('F') convert results to upper case.Eric Smith2008-07-171-5/+8
|
* Rename bytesobject.c back to stringobject.c to keep with the PyString theme.Gregory P. Smith2008-06-101-0/+5215
| | | | Part of reverting most of r63675 per the mailing list discussion.
* Renamed bytesobject.c to bytearrayobject.cChristian Heimes2008-05-261-5176/+0
| | | | | Renamed stringobject.c to bytesobject.c Fixed Windows builds
* Renamed PyString to PyBytesChristian Heimes2008-05-261-481/+481
|
* First step of the C API rename:Christian Heimes2008-05-261-2/+2
| | | | | | renamed Include/bytesobject.h to Include/bytearrayobject.h renamed Include/stringobject.h to Include/bytesobject.h added Include/stringobject.h with aliases
* #2809 followup: even better split docstring.Georg Brandl2008-05-111-2/+2
|
* Addresses issue 2802: 'n' formatting for integers.Eric Smith2008-05-111-0/+4
| | | | | | | | | | | | | | Adds 'n' as a format specifier for integers, to mirror the same specifier which is already available for floats. 'n' is the same as 'd', but inserts the current locale-specific thousands grouping. I added this as a stringlib function, but it's only used by str type, not unicode. This is because of an implementation detail in unicode.format(), which does its own str->unicode conversion. But the unicode version will be needed in 3.0, and it may be needed by other code eventually in 2.6 (maybe decimal?), so I left it as a stringlib implementation. As long as the unicode version isn't instantiated, there's no overhead for this.
* #2809: elaborate str.split docstring a bit.Georg Brandl2008-05-111-1/+2
|
* get rid of assert (size >= 0) now that an explicit if (size < 0) is in the code.Gregory P. Smith2008-04-101-1/+0
|
* Raise SystemError when size < 0 is passed into PyString_FromStringAndSize,Gregory P. Smith2008-04-091-0/+5
| | | | PyBytes_FromStringAndSize or PyUnicode_FromStringAndSize. [issue2587]
* Merged revisions ↵Christian Heimes2008-03-261-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 61750,61752,61754,61756,61760,61763,61768,61772,61775,61805,61809,61812,61819,61917,61920,61930,61933-61934 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/trunk-bytearray ........ r61750 | christian.heimes | 2008-03-22 20:47:44 +0100 (Sat, 22 Mar 2008) | 1 line Copied files from py3k w/o modifications ........ r61752 | christian.heimes | 2008-03-22 20:53:20 +0100 (Sat, 22 Mar 2008) | 7 lines Take One * Added initialization code, warnings, flags etc. to the appropriate places * Added new buffer interface to string type * Modified tests * Modified Makefile.pre.in to compile the new files * Added bytesobject.c to Python.h ........ r61754 | christian.heimes | 2008-03-22 21:22:19 +0100 (Sat, 22 Mar 2008) | 2 lines Disabled bytearray.extend for now since it causes an infinite recursion Fixed serveral unit tests ........ r61756 | christian.heimes | 2008-03-22 21:43:38 +0100 (Sat, 22 Mar 2008) | 5 lines Added PyBytes support to several places: str + bytearray ord(bytearray) bytearray(str, encoding) ........ r61760 | christian.heimes | 2008-03-22 21:56:32 +0100 (Sat, 22 Mar 2008) | 1 line Fixed more unit tests related to type('') is not unicode ........ r61763 | christian.heimes | 2008-03-22 22:20:28 +0100 (Sat, 22 Mar 2008) | 2 lines Fixed more unit tests Fixed bytearray.extend ........ r61768 | christian.heimes | 2008-03-22 22:40:50 +0100 (Sat, 22 Mar 2008) | 1 line Implemented old buffer interface for bytearray ........ r61772 | christian.heimes | 2008-03-22 23:24:52 +0100 (Sat, 22 Mar 2008) | 1 line Added backport of the io module ........ r61775 | christian.heimes | 2008-03-23 03:50:49 +0100 (Sun, 23 Mar 2008) | 1 line Fix str assignement to bytearray. Assignment of a str of size 1 is interpreted as a single byte ........ r61805 | christian.heimes | 2008-03-23 19:33:48 +0100 (Sun, 23 Mar 2008) | 3 lines Fixed more tests Fixed bytearray() comparsion with unicode() Fixed iterator assignment of bytearray ........ r61809 | christian.heimes | 2008-03-23 21:02:21 +0100 (Sun, 23 Mar 2008) | 2 lines str(bytesarray()) now returns the bytes and not the representation of the bytearray object Enabled and fixed more unit tests ........ r61812 | christian.heimes | 2008-03-23 21:53:08 +0100 (Sun, 23 Mar 2008) | 3 lines Clear error PyNumber_AsSsize_t() fails Use CHARMASK for ob_svall access disabled a test with memoryview again ........ r61819 | christian.heimes | 2008-03-23 23:05:57 +0100 (Sun, 23 Mar 2008) | 1 line Untested updates to the PCBuild directory ........ r61917 | christian.heimes | 2008-03-26 00:57:06 +0100 (Wed, 26 Mar 2008) | 1 line The type system of Python 2.6 has subtle differences to 3.0's. I've removed the Py_TPFLAGS_BASETYPE flags from bytearray for now. bytearray can't be subclasses until the issues with bytearray subclasses are fixed. ........ r61920 | christian.heimes | 2008-03-26 01:44:08 +0100 (Wed, 26 Mar 2008) | 2 lines Disabled last failing test I don't understand what the test is testing and how it suppose to work. Ka-Ping, please check it out. ........ r61930 | christian.heimes | 2008-03-26 12:46:18 +0100 (Wed, 26 Mar 2008) | 1 line Re-enabled bytes warning code ........ r61933 | christian.heimes | 2008-03-26 13:20:46 +0100 (Wed, 26 Mar 2008) | 1 line Fixed a bug in the new buffer protocol. The buffer slots weren't copied into a subclass. ........ r61934 | christian.heimes | 2008-03-26 13:25:09 +0100 (Wed, 26 Mar 2008) | 1 line Re-enabled bytearray subclassing - all tests are passing. ........
* Fix the overflows in expandtabs(). "This time for sure!"Guido van Rossum2008-03-111-25/+32
| | | | (Exploit at request.)
* Issue 1742669. Now %d accepts very big float numbers.Facundo Batista2008-02-241-16/+46
| | | | Thanks Gabriel Genellina.
* Backport of PEP 3101, Advanced String Formatting, from py3k.Eric Smith2008-02-171-9/+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).
* #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and ↵Christian Heimes2007-12-191-64/+64
| | | | Py_REFCNT. Macros for b/w compatibility are available.
* When splitting, avoid making a copy of the string if the split doesn't findSkip Montanaro2007-12-081-11/+42
| | | | anything (issue 1538).
* Now in find, rfind, index, and rindex, you can use None as defaults,Facundo Batista2007-11-161-2/+13
| | | | | | | | | | | | 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.
* Add missing "return NULL" in overflow check in PyObject_Repr().Guido van Rossum2007-11-061-0/+1
|
* Backport fixes for the code that decodes octal escapes (and for PyStringGuido van Rossum2007-10-291-4/+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.)
* Add a bunch of GIL release/acquire points in tp_print implementations and forBrett Cannon2007-09-171-2/+10
| | | | | | PyObject_Print(). Closes issue #1164.
* Improve extended slicing support in builtin types and classes. Specifically:Thomas Wouters2007-08-281-0/+11
| | | | | | | | | | | | | | | | | | | | - 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.
* 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-68/+66
| | | | | 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.
* SF 1193128: Let str.translate(None) be an identity transformationRaymond Hettinger2007-04-121-8/+16
|
* Backport from Py3k branch: fix refleak in PyString_Format.Georg Brandl2007-02-261-1/+5
|
* 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.
* Whitespace only changesNeal Norwitz2007-02-251-3/+2
|
* Add more details when releasing interned stringsNeal Norwitz2007-02-251-1/+8
|
* Patch [ 1586791 ] better error msgs for some TypeErrorsGeorg Brandl2006-11-191-6/+10
|
* Forward-port of r52136,52138: a review of overflow-detecting code.Armin Rigo2006-10-041-6/+19
| | | | | | | | | | | | | | | | | | | | | | | * 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
|
* Fix refleak introduced in rev. 51248.Georg Brandl2006-08-141-1/+3
|