Commit Graph

381 Commits

Author SHA1 Message Date
Senthil Kumaran 5e3a19d806 merge from 3.2 - Fix closes Issue12621 - Fix docstrings of find and rfind methods of bytes/bytearry/unicodeobject. 2011-07-27 23:36:51 +08:00
Mark Dickinson cb9bf1ac9c Issue #12164: Document (in docstring) that str.translate accepts None for the first argument. 2011-06-25 11:00:12 +02:00
Ezio Melotti e3685f6b1b #6780: fix starts/endswith error message to mention that tuples are accepted too. 2011-04-26 05:12:51 +03:00
Jesus Cea 44e81687a2 startswith and endswith don't accept None as slice index. Patch by Torsten Becker. (closes #11828) 2011-04-20 16:39:15 +02:00
Eli Bendersky 72de205895 Issue #11634: Remove misleading paragraph from a comment 2011-03-24 22:38:25 +02:00
Ezio Melotti 24b07bcba3 #11515: fix several typos. Patch by Piotr Kasprzyk. 2011-03-15 18:55:01 +02:00
Eric Smith 6c84085cfb Improved docstrings for str and unicode methods format and __format__. 2010-11-06 19:43:44 +00:00
Georg Brandl 05f819b6e9 #9328: string format methods return strings. 2010-07-31 19:07:37 +00:00
Ezio Melotti 2f06b78d61 Fix extra space. 2010-06-26 18:44:42 +00:00
Antoine Pitrou 619f16e194 Issue #8930: fix some C code indentation 2010-06-09 16:24:00 +00:00
Antoine Pitrou c83ea137d7 Untabify C files. Will watch buildbots. 2010-05-09 14:46:46 +00:00
Benjamin Peterson 6caf7ff505 always check _PyString_Resize for error
also normalize how this error is checked
2010-04-02 23:59:41 +00:00
Ezio Melotti 1fafaab5e5 #7775: fixed docstring for rpartition 2010-01-25 11:24:37 +00:00
Antoine Pitrou 6467213bfd Issue #7622: Improve the split(), rsplit(), splitlines() and replace()
methods of bytes, bytearray and unicode objects by using a common
implementation based on stringlib's fast search.  Patch by Florent Xicluna.
2010-01-13 07:55:48 +00:00
Antoine Pitrou 5b7139aab4 Issue #7462: Implement the stringlib fast search algorithm for the `rfind`,
`rindex`, `rsplit` and `rpartition` methods.  Patch by Florent Xicluna.
2010-01-02 21:12:58 +00:00
Eric Smith c4ab8339e9 Issue #3382: Make '%F' and float.__format__('F') convert results to upper case. Much of the patch came from Mark Dickinson. 2009-11-29 17:40:57 +00:00
Mark Dickinson 9dd5e16c5d Issue #7117, continued: Remove substitution of %g-style formatting for
%f-style formatting, which used to occur at high precision.  Float formatting
should now be consistent between 2.7 and 3.1.
2009-11-23 20:54:09 +00:00
Mark Dickinson 18cfada1ea Remove restriction on precision when formatting floats. This is the
first step towards removing the %f -> %g switch (see issues 7117,
5859).
2009-11-23 18:46:41 +00:00
Mark Dickinson 82864d1ab1 Issue #7228: Add '%lld' and '%llu' support to PyFormat_FromString,
PyFormat_FromStringV and PyErr_Format.
2009-11-15 16:18:58 +00:00
Eric Smith c1bdf89145 Finished removing _PyOS_double_to_string, as mentioned in issue 7117. 2009-10-26 17:46:17 +00:00
Georg Brandl 9b4e5820cb #7116: str.join() takes an iterable. 2009-10-14 18:48:32 +00:00
Benjamin Peterson 332d721750 add keyword arguments support to str/unicode encode and decode #6300 2009-09-18 21:14:55 +00:00
Benjamin Peterson 4fe03350b5 use macros 2009-09-17 21:33:46 +00:00
Mark Dickinson 2fdd58ad18 Silence gcc 'comparison always false' warning 2009-08-28 20:46:24 +00:00
Eric Smith 068f06568b Issue #5835, deprecate PyOS_ascii_formatd.
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.
2009-04-25 21:40:15 +00:00
Mark Dickinson 174e909842 Issue #532631: Add paranoid check to avoid potential buffer overflow
on systems with sizeof(int) > 4.
2009-03-29 16:17:16 +00:00
Mark Dickinson 2e648ecc7d Issue #532631: Replace confusing fabs(x)/1e25 >= 1e25 test
with fabs(x) >= 1e50, and fix documentation.
2009-03-29 14:37:51 +00:00
Martin v. Löwis b90304acb9 Issue #4850: Change COUNT_ALLOCS variables to Py_ssize_t. 2009-01-07 18:40:40 +00:00
Mark Dickinson 826f3fefe5 Issue #4445: save 3 bytes (on average, on a typical machine) per
string allocation.
2008-12-05 21:55:28 +00:00
Andrew M. Kuchling efeb43eb31 Docstring change for *partition: use same tense as other docstrings.
Hyphenate left- and right-justified.
Fix 'registerd' typo
2008-10-04 01:05:56 +00:00
Amaury Forgeot d'Arc 3571fbfed7 Issue #3751: str.rpartition would perform a left-partition when called with
a unicode argument.

will backport.
2008-09-01 19:52:00 +00:00
Martin v. Löwis f91d46a17d Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple,
by denying s# to parse objects that have a releasebuffer procedure,
and introducing s*.

More module might need to get converted to use s*.
2008-08-12 14:49:50 +00:00
Antoine Pitrou 92a6240198 Preemptively backport the relevant parts of r65420 2008-08-02 21:58:05 +00:00
Neal Norwitz e7d8be80ba Security patches from Apple: prevent int overflow when allocating memory 2008-07-31 17:17:14 +00:00
Eric Smith d6c393ab2b Backed out r65069, pending fixing it in Windows. 2008-07-17 19:49:47 +00:00
Eric Smith 454816d8bd Issue 3382: Make '%F' and float.__format__('F') convert results to upper case. 2008-07-17 17:48:39 +00:00
Gregory P. Smith b7fea62cca Rename bytesobject.c back to stringobject.c to keep with the PyString theme.
Part of reverting most of r63675 per the mailing list discussion.
2008-06-10 21:23:22 +00:00
Christian Heimes 44720838eb Renamed bytesobject.c to bytearrayobject.c
Renamed stringobject.c to bytesobject.c
Fixed Windows builds
2008-05-26 13:01:01 +00:00
Christian Heimes 593daf545b Renamed PyString to PyBytes 2008-05-26 12:51:38 +00:00
Christian Heimes 3497f94476 First step of the C API rename:
renamed Include/bytesobject.h to Include/bytearrayobject.h
renamed Include/stringobject.h to Include/bytesobject.h
added Include/stringobject.h with aliases
2008-05-26 12:29:14 +00:00
Georg Brandl ecbbd94e71 #2809 followup: even better split docstring. 2008-05-11 20:53:55 +00:00
Eric Smith cf537ff39e Addresses issue 2802: 'n' formatting for integers.
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.
2008-05-11 19:52:48 +00:00
Georg Brandl dfb77dbc70 #2809: elaborate str.split docstring a bit. 2008-05-11 09:11:40 +00:00
Gregory P. Smith 2ea2968064 get rid of assert (size >= 0) now that an explicit if (size < 0) is in the code. 2008-04-10 19:50:36 +00:00
Gregory P. Smith c00eb73a30 Raise SystemError when size < 0 is passed into PyString_FromStringAndSize,
PyBytes_FromStringAndSize or PyUnicode_FromStringAndSize.  [issue2587]
2008-04-09 23:16:37 +00:00
Christian Heimes 1a6387e683 Merged revisions 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.
........
2008-03-26 12:49:49 +00:00
Guido van Rossum 5bdff60617 Fix the overflows in expandtabs(). "This time for sure!"
(Exploit at request.)
2008-03-11 21:18:06 +00:00
Facundo Batista c11cecf3d0 Issue 1742669. Now %d accepts very big float numbers.
Thanks Gabriel Genellina.
2008-02-24 03:17:21 +00:00
Eric Smith a9f7d62480 Backport of PEP 3101, Advanced String Formatting, from py3k.
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).
2008-02-17 19:46:49 +00:00
Christian Heimes e93237dfcc #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. Macros for b/w compatibility are available. 2007-12-19 02:37:44 +00:00