Commit Graph

82 Commits

Author SHA1 Message Date
Barry Warsaw 04d2d15b6b strop_upper(), strop_lower(): shared code version caused to much of a
performance hit.  Urg.  Reverted.

strop_joinfields(): re-instate optimizations for lists and tuples, but
support arbitrary other kinds of sequences as well.
1997-01-03 23:46:51 +00:00
Barry Warsaw e8fc29cde7 Several changes:
- split_whitespace(): slightly better memory ref handling when errors
  occur.

- strop_joinfields(): First argument can now be any sequence-protocol
  conformant object.

- strop_find(), strop_rfind(): Use PyArg_ParseTuple for optional
  arguments

- strop_lower(), strop_upper(): Factor logic into a common function
  do_casechange().

- strop_atoi(), strop_atol(): Use PyArg_ParseTuple.

- strop_maketrans(): arguments used to be optional, although the
  documentation doesn't reflect this.  Make the source conform to the
  docs.  Arguments are required, but two empty strings will return the
  identity translation table.

- General pass fixing up formatting, and checking for return values.
1997-01-03 22:45:34 +00:00
Barry Warsaw f52560197f Greatly renamed. 1996-12-09 18:35:56 +00:00
Guido van Rossum a376cc5cc8 Keep gcc -Wall happy. 1996-12-05 23:43:35 +00:00
Guido van Rossum d266eb460e New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
Guido van Rossum a0ca4c402d Replace all uses of strncmp (in split, find, rfind) with memcmp, so
embedded \0 in the delimiter is handled properly.  Thanks to Sjoerd
for suggesting this.
1996-10-04 13:39:37 +00:00
Guido van Rossum c35f933c44 Add text of argument to errors for atoi(), atol(), atof(). 1996-09-11 23:30:42 +00:00
Guido van Rossum 171191efb2 Raise ValueError on empty string passed into atoi(), atol(), atof(). 1996-08-21 20:02:25 +00:00
Guido van Rossum 860986812a Remove some unused variables. 1996-08-19 22:02:43 +00:00
Guido van Rossum 7999a5c525 Added lstrip() and rstrip().
Extended split() (and hence splitfields(), which is the same function)
to support an optional third parameter giving the maximum number of
delimiters to parse.
1996-08-08 19:16:15 +00:00
Guido van Rossum ed7253ca50 Added 3rd optional argument to translate(), a string of characters to delete.
Added maketrans(), a utility to create a translation table.
1996-07-23 18:12:39 +00:00
Guido van Rossum 529c963d36 Test for zero-length argument in capitalize(). 1996-06-17 16:59:33 +00:00
Guido van Rossum 2745753b91 added capitalize() 1996-06-12 04:24:52 +00:00
Guido van Rossum a3127e8e11 added strop.translate(s, table) 1995-09-13 17:39:06 +00:00
Guido van Rossum 009e79bf02 unified join(fields), split(fields) 1995-05-03 17:40:23 +00:00
Guido van Rossum ee1813de2a fix stupid bug in strip and split 1995-02-14 00:58:59 +00:00
Guido van Rossum 7f7f274839 use Py_CHARMASK 1995-02-10 17:01:56 +00:00
Guido van Rossum 524b588553 Added 1995 to copyright message.
Setup.in: clarified Tk comments somewhat.
structmodule.c: use memcpy() instead of double precision assignment.
1995-01-04 19:10:35 +00:00
Guido van Rossum 602099a756 * various modules: #include "Python.h" and remove most remporary
renaming hacks
1994-09-14 13:32:22 +00:00
Guido van Rossum 5806a4f5c3 * Modules/stropmodule.c: implement find/rfind instead of
index/rindex (raising and catching an exception is much more
	expensive than returning and testing -1)
1994-08-17 13:15:46 +00:00
Guido van Rossum c65a525cdc * Modules/{Setup.in,Makefile.pre.in}: renamed some modules to
shorter names (dropped the "module" from the name): sunaudiodev,
	imgformat, audioop, imageop, imgfile

	* Modules/stropmodule.c (strop_rindex): make rindex('abc', '') do
	the right thing (i.e. return 3 instead of 0)

	* Modules/socketmodule.c: disabled allowbroadcast() socket method
1994-08-05 13:44:50 +00:00
Guido van Rossum b6775db241 Merge alpha100 branch back to main trunk 1994-08-01 11:34:53 +00:00
Guido van Rossum 572d2d994d Fix memory leaks in join & joinfields 1993-11-05 10:14:49 +00:00
Guido van Rossum ee9012f58f Added rindex(). index() and rindex() interpret negative start index
as normal indexing does.
1993-10-26 15:23:55 +00:00
Sjoerd Mullender 3bb8a05947 Several optimizations and speed improvements.
cstubs: Use Matrix type instead of float[4][4].
1993-10-22 12:04:32 +00:00
Sjoerd Mullender d96ec44f38 Bug fix: check whether call succeeded *after* the call. 1993-09-14 08:37:39 +00:00
Guido van Rossum e22e6442b7 * config.c: different default PYTHONPATH for MS-DOS
* timemodule.c: change #ifdef TURBO_C into #ifdef MSDOS
* posixmodule.c: MSDOS changes by Marcel van der Peijl (Digicash)
* stropmodule.c: use C isspace(c) to test for whitespace; add
  whitespace, lowercase and uppercase variables to the module.
1993-07-09 10:51:31 +00:00
Guido van Rossum d05eb8b0fc stropmodule.c: use C isspace(c) to test for whitespace; add
whitespace variable to module dict.
1993-07-08 11:12:36 +00:00
Guido van Rossum 9bfef44d97 * Changed all copyright messages to include 1993.
* Stubs for faster implementation of local variables (not yet finished)
* Added function name to code object.  Print it for code and function
  objects.  THIS MAKES THE .PYC FILE FORMAT INCOMPATIBLE (the version
  number has changed accordingly)
* Print address of self for built-in methods
* New internal functions getattro and setattro (getattr/setattr with
  string object arg)
* Replaced "dictobject" with more powerful "mappingobject"
* New per-type functio tp_hash to implement arbitrary object hashing,
  and hashobject() to interface to it
* Added built-in functions hash(v) and hasattr(v, 'name')
* classobject: made some functions static that accidentally weren't;
  added __hash__ special instance method to implement hash()
* Added proper comparison for built-in methods and functions
1993-03-29 10:43:31 +00:00
Guido van Rossum c89705d697 * config.c: Added audioop to lists.
* Makefile: change default source directory
* socketmodule.c: added getsockname and getpeername
* bltinmodule.c: corrected typo in type() error message
* Added new built-in functions str() and repr(): repr(x) == `x`;
  str(x) == x if x is a string, otherwise str(x) == repr(x).
* Added joinfields to stropmodule.c (string.join calls joinfields now)
1992-11-26 08:54:07 +00:00
Guido van Rossum 5c85062e1c Makefile uses $> more often; cgen supports filename argument; added
lower, upper and swapcase to strop; cosmetics.
1992-09-11 23:55:51 +00:00
Guido van Rossum e270b432f3 Re-implement some operations from string.py in C, for speed. 1992-09-03 20:21:07 +00:00