Commit Graph

45 Commits

Author SHA1 Message Date
Guido van Rossum 1ad1b3f911 Forgot to return NULL in joinfields() when a type error was detected
in one of the sequence items.
1998-02-06 22:37:12 +00:00
Guido van Rossum 74608f8b8a Oops, big glitch. Charles had put a 1 in the column for argument list
type for all functions.  However many function call PyArg_Parse() and
need a 0.  This is so that when they didn't change anything, the can
do Py_INCREF(args); return args.  Reverted this back.  For atof(),
there's no reason not to use PyArg_ParseTuple(), so I changed the code
(atoi and atol already used that).
1997-12-30 05:44:10 +00:00
Guido van Rossum 786205e385 Oops, the last checkin left a blank line in a string literal. 1997-12-30 05:10:14 +00:00
Guido van Rossum 23e21e7cf3 Minor editing corrections. 1997-12-29 19:57:36 +00:00
Guido van Rossum 983c930c8d Added doc string, provided by Charles Waldman (with some reformatting
and a little editing my me).
1997-12-29 19:52:29 +00:00
Barry Warsaw 93be92d309 split_whitespace(): Make sure delimiter is stripped from the beginning
of the remainder item (last item in list) when maxsplit is < the
number of occurrences.
1997-12-02 00:29:30 +00:00
Barry Warsaw f577c08683 mymemreplace(), strop_replace(): Add support for optional 4th argument
maxsplit which is implemented in string.py but wasn't here.  The
reference manual doesn't define what happens when maxsplit is negative
or larger than the number of occurrences, but in either case, I
implemented this as all get replaced.  Default value is zero which
replaces all occurrences.
1997-11-29 00:10:07 +00:00
Guido van Rossum 1ed5e57684 Keep gcc -Wall happy. 1997-04-29 21:34:16 +00:00
Guido van Rossum 101923bba6 Added replace() implementation by Perry Stoll (debugged and reformatted by me). 1997-04-02 06:11:18 +00:00
Guido van Rossum 7b7c578616 Add optional 4th argument to [r]find and [r]index (end of slice). 1997-03-14 04:13:56 +00:00
Guido van Rossum 52fa3a6909 Changes for Lee Busby's SIGFPE patch set.
Two new modules fpectl and fpetest.
Surround various and sundry f.p. operations with PyFPE_*_PROTECT macros.
1997-02-14 22:59:58 +00:00
Barry Warsaw d4ff1b908b New strop_joinfields implementation, highly optimized for Lists. All
other sequences use the Sequence protocol from the abstract API.  The
algorithm has changed so that only one pass through the sequences are
made.
1997-01-06 22:48:32 +00:00
Guido van Rossum e0548b8da7 Rewrote translate() as follows:
- 'delete' is a C++ keyword; use 'del_table' instead
	- apply Py_CHARMASK() to del_table[i] before using it as an index
	  *** this fixes a bug that was just reported on the list ***
	- if the translation didn't make any changes, INCREF and return
	  the original string
	- when del_table is empty or omitted, don't copy the translation
	  table to a table of ints (should be a bit faster)

Rewrote maketrans() to avoid copying the table (2-3% faster).
1997-01-06 16:50:09 +00:00
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