Commit Graph

179 Commits

Author SHA1 Message Date
Andrew M. Kuchling 1991ddc3e1 Make multiplying a sequence by a long integer (5L * 'b') legal 2000-02-14 22:22:04 +00:00
Barry Warsaw 226ae6ca12 Mainlining the string_methods branch. See branch revision log
messages for specific changes.
1999-10-12 19:54:53 +00:00
Guido van Rossum 031d0e5feb Patch by Charles Waldman -- remove unneeded and even harmful test for
float to the negative power (which is already and better done in
floatobject.c.)
1999-01-10 16:56:58 +00:00
Guido van Rossum f5046d1aea Remove prototype for PyOS_strtol -- Chris Herborth. 1998-12-10 16:54:48 +00:00
Guido van Rossum 9d904b9389 Believe it or not, Solaris 2.6 strtod() can move the end pointer
*beyond* the null byte at the end of the input string, when the input
is inf(inity).  Discovered by Greg Ward.
1998-10-01 20:35:46 +00:00
Guido van Rossum 21308243ca Better error messages when a sequence is indexed with a non-integer.
Previously, this said "unsubscriptable object"; in 1.5.1, the reverse
problem existed, where None[''] would complain about a non-integer
index.  This fix does the right thing in all cases (for get, set and
del item).
1998-08-13 16:44:44 +00:00
Guido van Rossum df3d8756b7 Better error messages when raising ValueError for int and long
literals.  (The previous version of this code would not show the
offending input, even though there was code that attempted this.)
1998-08-04 15:02:01 +00:00
Guido van Rossum 5dba9e8aef Add special case to PySequence_List() so that list() of a list is
faster (using PyList_GetSlice()).  Also added a test for a NULL
argument, as with PySequence_Tuple().  (Hmm...  Better names for these
two would be PyList_FromSequence() and PyTuple_FromSequence().  Oh well.)
1998-07-10 18:03:50 +00:00
Guido van Rossum bfc725bf64 Changed PySequence_List() and PySequence_Tuple() to support
"indefinite length" sequences.  These should still have a length, but
the length is only used as a hint -- the actual length of the sequence
is determined by the item that raises IndexError, which may be either
smaller or larger than what len() returns.  (This is a novelty; map(),
filter() and reduce() only allow the actual length to be larger than
what len() returns, not shorter.  I'll fix that shortly.)
1998-07-10 16:22:44 +00:00
Guido van Rossum 3b2b34790f Fix the tests for various anomalies in the string-to-numbers
conversions.  Formerly, for example, int('-') would return 0 instead
of raising ValueError, and int(' 0') would raise ValueError
(complaining about a null byte!) instead of 0...
1998-06-22 03:54:15 +00:00
Guido van Rossum ed6219b116 Fix a whole bunch of error return NULL that should be return -1. 1998-05-29 02:59:33 +00:00
Guido van Rossum 08570decb7 Uses PyErr_ExceptionMatches() instead of comparing PyErr_Occurred(). 1998-05-28 19:24:35 +00:00
Guido van Rossum fa0b6ab01a Address some gcc -Wall warnings (e.g. include <ctype.h>).
Make sure that no tp_as_numbers->nb_<whatever> function is called
without checking for a NULL pointer.  Marc-Andre Lemburg will love it!
(Except that he's just rewritten all this code for a different
approach to coercions ;-( )
1998-05-22 15:23:36 +00:00
Guido van Rossum cea1c8ca22 Completely reformatted, standardizing indentation as well as
programming style.

Recoded many routines to incorporate better error checking, and/or
better versions of the same function found elsewhere
(e.g. bltinmodule.c or ceval.c).  In particular,
Py_Number_{Int,Long,Float}() now convert from strings, just like the
built-in functions int(), long() and float().

Sequences and mappings are now safe to have NULL function pointers
anywhere in their tp_as_sequence or tp_as_mapping fields.  (A few
places in other files need to be checked in too.)

Renamed PySequence_In() to PySequence_Contains().
1998-05-22 00:47:05 +00:00
Guido van Rossum f7d590c93d This was the reason a numeric array to a real power was not working. 1998-04-03 23:38:59 +00:00
Guido van Rossum a9040ec5d9 Renamed a local variable from 'PyCFunction' (which is also a typedef
in methodobject.h) to 'func'.  /bin/cc on SunOS 4.x didn't grok this.
1997-05-20 22:09:08 +00:00
Guido van Rossum e61093c218 Fix reversed test for failure in PySequence_List() and PySequence_Tuple().
This broke cPickle.
1997-05-14 18:43:29 +00:00
Guido van Rossum c0b618a2cc Quickly renamed the last directory. 1997-05-02 03:12:38 +00:00
Guido van Rossum 4669fb474b Several fixes reported by jim F. 1997-04-02 05:31:09 +00:00
Barry Warsaw f90eddef5d PySequence_Index(): set exception when object is not found in
sequence, otherwise

operator.indexOf([4, 3, 2, 1], 9) would raise a SystemError!

Note: it might be wise to double check all these functions.  I haven't
done that yet.
1996-12-18 19:32:18 +00:00
Guido van Rossum 3c5936afc5 Added missing PySequence_List.
Correct typo in error msg (expec[t]ed).
Make gcc -Wall happy.
1996-12-05 21:51:24 +00:00
Guido van Rossum 052b7e1cfb Make Py_ReturnNullError() statis as it should be. 1996-11-11 15:08:19 +00:00
Guido van Rossum 08ef9d98b2 Only call sq_length in Sequence_GetItem for negative index. 1996-11-09 22:32:05 +00:00
Guido van Rossum 8dbcdd0a4c correct typo in return variable for PySequence_Index() 1996-11-06 15:31:46 +00:00
Guido van Rossum d266eb460e New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
Guido van Rossum 336c699236 Fix subtle bug detected by Jim F. 1996-09-30 22:00:50 +00:00
Guido van Rossum 6cdc6f4146 Added PyObject_DelItem and PySequence_Del{Item,Slice}. 1996-08-21 17:41:54 +00:00
Guido van Rossum 8ba873b8ad adapted to K&R C 1995-09-18 21:17:59 +00:00
Guido van Rossum e15dee5e3c Generic Abstract Object Interface 1995-07-18 14:12:02 +00:00