summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* Added doc strings for methods and a new pop() method.Guido van Rossum1998-06-301-7/+54
|
* New feature: if the object's type has a non-NULL tp_doc field, thatGuido van Rossum1998-06-271-2/+9
| | | | | | is returned as the object's __doc__ attribute. (If only the list of methods would be referenced from the type...)
* Slight rearrangement of some code to make it faster, by VladimirGuido van Rossum1998-06-261-9/+15
| | | | Marangozov.
* Add check in long-to-int conversion for at least one digit.Guido van Rossum1998-06-221-0/+7
|
* 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...
* Minor cleanup by Tim after my changes:Guido van Rossum1998-06-171-25/+19
| | | | | | | | | | | | + Took the "list" argument out of the other functions that no longer need it. This speeds things up a little more. + Small comment changes in accord with that. + Exploited the now-safe ability to cache values in the partitioning loop. Makes no timing difference on my flavor of Pentium, but this machine ran out of registers 12 iterations ago. It should yield a small speedup on a RISC machine, and not hurt in any case.
* Tim's latest, with some of my changes (also a TP suggestion) added:Guido van Rossum1998-06-161-218/+551
| | | | | | | | | | instead of testing whether the list changed size after each comparison, temporarily set the type of the list to an immutable list type. This should allow continued use of the list for legitimate purposes but disallows all operations that can change it in any way. (Changes to the internals of list items are not caught, of cause; that's not possible to detect, and it's not necessary to protect the sort code, either.)
* Keep Microsoft's compiler happy.Guido van Rossum1998-06-121-4/+1
|
* When comparing objects of different types (which is done by comparingGuido van Rossum1998-06-091-8/+15
| | | | | the type names), make sure that numeric objects are considered smaller than all other objects, by forcing their name to "".
* Should check that PyObject_Str() really returned a string!Guido van Rossum1998-06-091-0/+5
|
* Allow assignments to special class attributes -- with typechecks, andGuido van Rossum1998-05-291-12/+87
| | | | | | | | | | | | | | | | | | | not in restricted mode. __dict__ can be set to any dictionary; the cl_getattr, cl_setattr and cl_delattr slots are refreshed. __name__ can be set to any string. __bases__ can be set to to a tuple of classes, provided they are not subclasses of the class whose attribute is being assigned. __getattr__, __setattr__ and __delattr__ can be set to anything, or deleted; the appropriate slot (cl_getattr, cl_setattr, cl_delattr) is refreshed. (Note: __name__ really doesn't need to be a special attribute, but that would be more work.)
* Tim's revision of the previous patch. He also added some sparts toGuido van Rossum1998-05-291-43/+35
| | | | the median-of-three code to get a few percent back.
* Fix a whole bunch of error return NULL that should be return -1.Guido van Rossum1998-05-291-5/+5
|
* Guard against changes in the list size during a compare or sort.Guido van Rossum1998-05-281-22/+31
|
* Uses PyErr_ExceptionMatches() instead of comparing PyErr_Occurred().Guido van Rossum1998-05-281-1/+1
|
* Uses PyErr_ExceptionMatches() instead of comparing PyErr_Occurred().Guido van Rossum1998-05-281-1/+1
|
* Tim's quicksort on May 25.Guido van Rossum1998-05-261-123/+141
|
* Subject: Buglet in PyLong_AsLongGuido van Rossum1998-05-261-9/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From: "Tim Peters" <tim_one@email.msn.com> To: "Guido van Rossum" <guido@CNRI.Reston.VA.US> Date: Sat, 23 May 1998 21:45:53 -0400 Guido, the overflow checking in PyLong_AsLong is off a little: 1) If the C in use sign-extends right shifts on signed longs, there's a spurious overflow error when converting the most-negative int: Python 1.5.1 (#0, Apr 13 1998, 20:22:04) [MSC 32 bit (Intel)] on win32 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> x = -1L << 31 >>> x -2147483648L >>> int(x) Traceback (innermost last): File "<stdin>", line 1, in ? OverflowError: long int too long to convert >>> 2) If C does not sign-extend, some genuine overflows won't be caught. The attached should repair both, and, because I installed a new disk and a C compiler today, it's even been compiled this time <wink>. Python 1.5.1 (#0, May 23 1998, 20:24:58) [MSC 32 bit (Intel)] on win32 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> x = -1L << 31 >>> x -2147483648L >>> int(x) -2147483648 >>> int(-x) Traceback (innermost last): File "<stdin>", line 1, in ? OverflowError: long int too long to convert >>> int(-x-1) 2147483647 >>> int(x-1) Traceback (innermost last): File "<stdin>", line 1, in ? OverflowError: long int too long to convert >>> end-casing-ly y'rs - tim
* 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 ;-( )
* Make function objects somewhat mutable -- the members func_code,Guido van Rossum1998-05-221-3/+35
| | | | | | func_defaults and func_doc (alias __doc__) may be assigned to. For the first two, there's a type restriction to code object and tuple, respectively.
* In PyObject_IsTrue(), don't call function pointers that are NULLGuido van Rossum1998-05-221-3/+6
| | | | (nb_nonzero, mp_length, sq_length).
* 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().
* Since PyDict_GetItem() can't raise an exception any more, there's noGuido van Rossum1998-05-141-4/+1
| | | | need to cxall PyErr_Clear() when it returns NULL.
* Make sure that PyDict_GetItem[String]() *never* raises an exception.Guido van Rossum1998-05-141-2/+3
| | | | | If the argument is not a dictionary, simply return NULL. If the hash() on the key fails, clear the error.
* Remove a redundant statement from halfbinop().Guido van Rossum1998-05-131-1/+0
|
* Tim's quicksort on May 13.Guido van Rossum1998-05-131-1/+1
|
* Tim's quicksort on May 10.Guido van Rossum1998-05-131-68/+99
|
* Add check to conjugate() that there are no excess arguments.Guido van Rossum1998-05-071-2/+5
|
* Ugly band-aid to work around a bug in Linux ftell().Guido van Rossum1998-05-051-1/+3
|
* Get rid of the unused ifdefed-out old sort code.Guido van Rossum1998-04-281-76/+0
|
* If USE_STACKCHECK is defined use PyOS_CheckStack() in the repr and strGuido van Rossum1998-04-281-0/+12
| | | | | | routines. This catches a slightly different set of crashes than the recursive-repr fix. (Jack)
* Enable ftruncate() on the Mac.Guido van Rossum1998-04-281-0/+6
| | | | (Jack)
* Quicksort retuned by Tim Peters.Guido van Rossum1998-04-281-33/+26
|
* Clear the error condition set by ftell().Guido van Rossum1998-04-271-0/+2
|
* Be less naive about null characters in an object's repr().Guido van Rossum1998-04-211-2/+2
|
* Some robustness checks in Py_ReprLeave() in the unlikely event someoneGuido van Rossum1998-04-111-0/+4
| | | | has messed with the dictionary or list.
* Use Py_Repr{Enter,Leave} to display recursive lists in finite space.Guido van Rossum1998-04-101-1/+20
| | | | (Jeremy will hardly recognize his patch :-)
* Use Py_Repr{Enter,Leave} to display recursive dictionaries in finite space.Guido van Rossum1998-04-101-5/+31
| | | | (Jeremy will hardly recognize his patch :-)
* Add implementations of Py_Repr{Enter,Leave}.Guido van Rossum1998-04-101-0/+64
| | | | (Jeremy will hardly recognize his patch :-)
* Make new gcc -Wall happyGuido van Rossum1998-04-104-7/+13
|
* Add PyObject_Not().Guido van Rossum1998-04-091-0/+14
|
* This was the reason a numeric array to a real power was not working.Guido van Rossum1998-04-031-1/+2
|
* Subtle fix in the read() code which could cause a read broken up inGuido van Rossum1998-03-181-1/+1
| | | | several pieces to fail...
* When we have no setvbuf(), make the file totally unbuffered usingGuido van Rossum1998-03-061-1/+4
| | | | setbuf() if a buffer size of 0 or 1 byte is requested.
* Of course, I shouldn't have used lseek() to find out the file'sGuido van Rossum1998-03-031-6/+3
| | | | | position in new_buffersize(); the correct function to use is ftell(). Thanks to Ben Jackson.
* Add back some safeguards on the index elements that were lost in theGuido van Rossum1998-02-251-2/+2
| | | | | | | | | | last patch. Dave Ascher found a case that dumps core without these: def myComparison(x,y): return cmp(x%3,y%7) z = range(12) z.sort(myComparison)
* Add internal routine _PyModule_Clear(), which does approximately whatGuido van Rossum1998-02-191-1/+50
| | | | | | | | | clear_carefully() used to do in import.c. Differences: leave only __builtins__ alone in the 2nd pass; and don't clear the dictionary (on the theory that as long as there are references left to the dictionary, those might be destructors that might expect __builtins__ to be alive when they run; and __builtins__ can't normally be part of a cycle).
* Vladimir Marangozov' performance hack: copy f_builtins from ancestorGuido van Rossum1998-02-191-3/+14
| | | | | | | if the globals are the same. Also, when creating a dummy builtins dictionary, add "None" to it, just to be kind.
* Check ferror(), not errno, for fread() error.Guido van Rossum1998-02-191-1/+1
|
* Instead of "attribute-less object", issue an error message thatGuido van Rossum1998-01-191-1/+4
| | | | contains the type of the object and name of the attribute.