summaryrefslogtreecommitdiffstats
path: root/Objects/abstract.c
Commit message (Collapse)AuthorAgeFilesLines
* Restore PyXXX_Length() APIs for binary compatibility.Marc-André Lemburg2000-07-171-0/+24
| | | | | | New code will see the macros and therefore use the PyXXX_Size() APIs instead. By Thomas Wouters.
* change abstract size functions PySequence_Size &c.Jeremy Hylton2000-07-121-8/+8
| | | | add macros for backwards compatibility with C source
* type_error(): Added "const" to signature to eliminate warning with -Wall.Fred Drake2000-07-091-1/+1
|
* ANSI-fication of the sources.Fred Drake2000-07-091-140/+55
|
* Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.Tim Peters2000-07-091-13/+13
|
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|
* Patch from /F:Andrew M. Kuchling2000-06-181-0/+20
| | | | | this patch introduces PySequence_Fast and PySequence_Fast_GET_ITEM, and modifies the list.extend method to accept any kind of sequence.
* Marc-Andre's third try at this bulk patch seems to work (except thatGuido van Rossum2000-04-051-42/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | his copy of test_contains.py seems to be broken -- the lines he deleted were already absent). Checkin messages: New Unicode support for int(), float(), complex() and long(). - new APIs PyInt_FromUnicode() and PyLong_FromUnicode() - added support for Unicode to PyFloat_FromString() - new encoding API PyUnicode_EncodeDecimal() which converts Unicode to a decimal char* string (used in the above new APIs) - shortcuts for calls like int(<int object>) and float(<float obj>) - tests for all of the above Unicode compares and contains checks: - comparing Unicode and non-string types now works; TypeErrors are masked, all other errors such as ValueError during Unicode coercion are passed through (note that PyUnicode_Compare does not implement the masking -- PyObject_Compare does this) - contains now works for non-string types too; TypeErrors are masked and 0 returned; all other errors are passed through Better testing support for the standard codecs. Misc minor enhancements, such as an alias dbcs for the mbcs codec. Changes: - PyLong_FromString() now applies the same error checks as does PyInt_FromString(): trailing garbage is reported as error and not longer silently ignored. The only characters which may be trailing the digits are 'L' and 'l' -- these are still silently ignored. - string.ato?() now directly interface to int(), long() and float(). The error strings are now a little different, but the type still remains the same. These functions are now ready to get declared obsolete ;-) - PyNumber_Int() now also does a check for embedded NULL chars in the input string; PyNumber_Long() already did this (and still does) Followed by: Looks like I've gone a step too far there... (and test_contains.py seem to have a bug too). I've changed back to reporting all errors in PyUnicode_Contains() and added a few more test cases to test_contains.py (plus corrected the join() NameError).
* Many changes for Unicode, by Marc-Andre Lemburg.Guido van Rossum2000-03-101-14/+134
|
* Patch by Moshe Zadka: remove the string special case inGuido van Rossum2000-03-071-18/+0
| | | | | PySequence_Contains() now that string objects have this code in their tp_contains.
* Patch by Mozhe Zadka, for __contains__ (overloading 'in'). ThisGuido van Rossum2000-02-281-1/+8
| | | | | patches PySequence_Contains() to check for a valid sq_contains field. More to follow.
* Allow using long integers as arguments to PyObject_GetItem(), _SetItem(),Andrew M. Kuchling2000-02-231-1/+19
| | | | | | and _DelItem(). In sequence multiplication by a long, only call PyErr_Occurred() when the value returned is -1.
* Make multiplying a sequence by a long integer (5L * 'b') legalAndrew M. Kuchling2000-02-141-2/+13
|
* Mainlining the string_methods branch. See branch revision logBarry Warsaw1999-10-121-119/+61
| | | | messages for specific changes.
* Patch by Charles Waldman -- remove unneeded and even harmful test forGuido van Rossum1999-01-101-10/+0
| | | | | float to the negative power (which is already and better done in floatobject.c.)
* Remove prototype for PyOS_strtol -- Chris Herborth.Guido van Rossum1998-12-101-1/+0
|
* Believe it or not, Solaris 2.6 strtod() can move the end pointerGuido van Rossum1998-10-011-1/+6
| | | | | *beyond* the null byte at the end of the input string, when the input is inf(inity). Discovered by Greg Ward.
* Better error messages when a sequence is indexed with a non-integer.Guido van Rossum1998-08-131-6/+17
| | | | | | | 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).
* Better error messages when raising ValueError for int and longGuido van Rossum1998-08-041-6/+9
| | | | | literals. (The previous version of this code would not show the offending input, even though there was code that attempted this.)
* Add special case to PySequence_List() so that list() of a list isGuido van Rossum1998-07-101-0/+6
| | | | | | 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.)
* Changed PySequence_List() and PySequence_Tuple() to supportGuido van Rossum1998-07-101-27/+38
| | | | | | | | | "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.)
* Fix the tests for various anomalies in the string-to-numbersGuido van Rossum1998-06-221-12/+8
| | | | | | 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...
* Fix a whole bunch of error return NULL that should be return -1.Guido van Rossum1998-05-291-5/+5
|
* Uses PyErr_ExceptionMatches() instead of comparing PyErr_Occurred().Guido van Rossum1998-05-281-1/+1
|
* Address some gcc -Wall warnings (e.g. include <ctype.h>).Guido van Rossum1998-05-221-29/+54
| | | | | | | 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 ;-( )
* Completely reformatted, standardizing indentation as well asGuido van Rossum1998-05-221-582/+900
| | | | | | | | | | | | | | | | 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().
* This was the reason a numeric array to a real power was not working.Guido van Rossum1998-04-031-1/+2
|
* Renamed a local variable from 'PyCFunction' (which is also a typedefGuido van Rossum1997-05-201-6/+6
| | | | in methodobject.h) to 'func'. /bin/cc on SunOS 4.x didn't grok this.
* Fix reversed test for failure in PySequence_List() and PySequence_Tuple().Guido van Rossum1997-05-141-2/+2
| | | | This broke cPickle.
* Quickly renamed the last directory.Guido van Rossum1997-05-021-11/+11
|
* Several fixes reported by jim F.Guido van Rossum1997-04-021-31/+28
|
* PySequence_Index(): set exception when object is not found inBarry Warsaw1996-12-181-0/+1
| | | | | | | | | 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.
* Added missing PySequence_List.Guido van Rossum1996-12-051-15/+44
| | | | | Correct typo in error msg (expec[t]ed). Make gcc -Wall happy.
* Make Py_ReturnNullError() statis as it should be.Guido van Rossum1996-11-111-1/+1
|
* Only call sq_length in Sequence_GetItem for negative index.Guido van Rossum1996-11-091-4/+6
|
* correct typo in return variable for PySequence_Index()Guido van Rossum1996-11-061-1/+1
|
* New permission notice, includes CNRI.Guido van Rossum1996-10-251-13/+20
|
* Fix subtle bug detected by Jim F.Guido van Rossum1996-09-301-1/+1
|
* Added PyObject_DelItem and PySequence_Del{Item,Slice}.Guido van Rossum1996-08-211-0/+61
|
* adapted to K&R CGuido van Rossum1995-09-181-35/+89
|
* Generic Abstract Object InterfaceGuido van Rossum1995-07-181-0/+972