summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Modified quicksort by Raymund Galvin, after studying the GNU libg++Guido van Rossum1997-12-101-23/+48
| | | | | quicksort. This should be much faster if there are lots of duplicates, and otherwise at least as good.
* Change the default repr() and str() of class instance objects to lookGuido van Rossum1997-12-031-1/+9
| | | | | like <modulename.classname instance at ...> (to match the repr() of class objects.
* Add a new function PyNumber_CoerceEx() which works just likeGuido van Rossum1997-11-191-3/+15
| | | | | | | | | | | | | | | | | PyNumber_Coerce() except that when the coercion can't be done and no other exceptions happen, it returns 1 instead of raising an exception. Use this function in PyObject_Compare() to avoid raising an exception simply because two objects with numeric behavior can't be coerced to a common type; instead, proceed with the non-numeric default comparison. Note that this is a somewhat questionable practice -- comparisons for numeric objects shouldn't default to random behavior like this, but it is required for backward compatibility. (Case in point, it broke comparison of kjDict objects to integers in Aaron Watters' kjbuckets extension.) A correct fix (for python 2.0) should involve a different definiton of comparison altogether.
* Undo another glitch of the automatic not-so-Grand Renaming; some localGuido van Rossum1997-11-181-10/+10
| | | | | variables called 'coerce' were accidentally renamed to 'PyNumber_Coerce'. Rename them back to coercefunc.
* Fix problem discovered by Barry: if you hit ^C toGuido van Rossum1997-11-071-2/+2
| | | | | | | sys.stdin.readline(), you get a fatal error (no current thread). This is because there was a call to PyErr_CheckSignals() while there was no current thread. I wonder how many more of these we find... I bnetter go hunting for PyErr_CheckSignals() now...
* Add cast to realloc/malloc call to shut up AIX compiler. (Vladimir Marangozov)Guido van Rossum1997-10-311-2/+3
|
* Hack suggested by Matthias Klose to pull in all relevant entry pointsGuido van Rossum1997-10-311-0/+10
| | | | | | in libmath.a so they are available to mathmodule.so (in case it is shared). While this still gets triggered on Solaris 2.x, this appears to be harmless there.
* New CObject from Jim Fulton, adds PyCObject_FromVoidPtrAndDesc() andGuido van Rossum1997-10-211-1/+52
| | | | PyCObject_GetDesc().
* Write a str() function for class objects that returnsGuido van Rossum1997-10-201-2/+36
| | | | "modulename.classname" instead of returning the same as repr().
* Correct Barry's fix -- take care of {}.get(0).Guido van Rossum1997-10-201-0/+3
|
* dict_get(): Fixed a couple of stupid mistakes which caused crashes.Barry Warsaw1997-10-201-8/+2
| | | | Also got rid of some unnecessary code.
* Check that all base classes are indeed class objects, rather thanGuido van Rossum1997-10-071-5/+30
| | | | expecting the caller to do so.
* dict_get(): New method for item access with different semantics thanBarry Warsaw1997-10-061-0/+38
| | | | | | | | | __getitem__(). This method never raises an exception; if the key is not in the dictionary, the second (optional) argument is returned. If the second argument is not provided and the key is missing, None is returned. mapp_methods: added "get" method.
* Don't intern the key string for getitem and delitem.Guido van Rossum1997-09-291-3/+1
|
* When creating a class, set its __module__ attribute to the moduleGuido van Rossum1997-09-121-1/+22
| | | | | whose name is in the current globals' __name__ variable. If __name__ is not set, ignore this.
* Patch submitted by Brad Howes (with one bug fixed by me): allowGuido van Rossum1997-09-081-8/+17
| | | | | | arbitrary nested parens in a %(...)X style format. #Also folded two lines and added more detail to the error message for #unsupported format character.
* Allow assignments to instance.__dict__ and instance.__class__. TheGuido van Rossum1997-08-251-17/+57
| | | | | | | | | | | | former lets you give an instance a set of new instance vars. The latter lets you give it a new class. Both are typechecked and disallowed in restricted mode. For classes, the check for read-only special attributes is tightened so that only assignments to __dict__, __bases__, __name__, __getattr__, __setattr__, and __delattr__ (these could be made to work as well, but I don't know if that's useful -- let's see first whether mucking with instances will help).
* Rename roundup() to roundupsize(), as there's a macro roundup() in theGuido van Rossum1997-08-251-2/+2
| | | | | sys/types.h header on many systems that may get pulled in (through WANT_SIGFPE_HANDLER which pulls in signal.h).
* Use lseek instead of ftell; compensate by adding BUFSIZEGuido van Rossum1997-08-211-2/+6
|
* Made lookdict nearly twice as fast, resulting in a 5% overallGuido van Rossum1997-08-181-11/+13
| | | | improvement of pystone. Vladimir Marangozov.
* PyTuple_SetItem should require that the tuple's refcnt is one!Guido van Rossum1997-08-171-1/+1
|
* Fix mixup about PyErr_NoMemory() prototype.Guido van Rossum1997-08-121-4/+8
|
* Fix bug in comparing function objects detected by Sjoerd:Guido van Rossum1997-08-051-3/+9
| | | | | | SystemError: bad argument to internal function caused by comparing NULL pointer default args.
* Added _Fini() routines to free up some memoryGuido van Rossum1997-08-053-1/+47
|
* Change the Fini function to only remove otherwise unreferenced stringsGuido van Rossum1997-08-051-6/+16
| | | | | | | | | | from the interned table. There are references in hard-to-find static variables all over the interpreter, and it's not worth trying to get rid of all those; but "uninterning" isn't fair either and may cause subtle failures later -- so we have to keep them in the interned table. Also get rid of no-longer-needed insert of None in interned dict.
* Added separate free list for cfunction (builtin method) objects, for aGuido van Rossum1997-08-051-7/+30
| | | | few percent speed up. Also add PyCFunction_Fini() to discard it.
* Provide a dummy empty directory as f_builtins instead of failing, whenGuido van Rossum1997-08-051-7/+22
| | | | | | | no valid directory is passed in. This prevents __del__ to fail when invoked after __builtins__ has already been discarded. Also add PyFrame_Fini() to discard the cache of frames.
* Added separate free list for instance method objects, for a fewGuido van Rossum1997-08-051-4/+28
| | | | percent speed up. Also add PyMethod_Fini() to discard it.
* Added _Py_ResetReferences(), if tracing references.Guido van Rossum1997-08-051-3/+84
| | | | | | | In _Py_PrintReferences(), no longer suppress once-referenced string. Add Py_Malloc and friends and PyMem_Malloc and friends (malloc wrappers for third parties).
* Avoid function calls to access the current thread state and builtinsGuido van Rossum1997-08-021-4/+2
| | | | | -- the thread state is passed in as an argument and the builtins are a member thereof.
* Added internal routine PyString_Fini() which deletes all internedGuido van Rossum1997-08-021-0/+18
| | | | strings. For use in Py_Finalize() only.
* New build procedure.Guido van Rossum1997-07-191-8/+9
|
* Reordered list of methods to hopefully put the most frequently usedGuido van Rossum1997-07-132-7/+7
| | | | ones near the front.
* Reordered list of methods to hopefully put the most frequently usedGuido van Rossum1997-07-131-8/+10
| | | | | | ones near the front. Also added a missing "return -1" to PyFile_WriteString.
* Use #include "mymath.h" instead of declaring fabs() explicitly.Guido van Rossum1997-06-031-2/+1
| | | | This should solve a weird problem on the Mac for Jack.
* Renamed dict.absorb() (too spungy) to dict.update().Guido van Rossum1997-06-021-3/+3
|
* American spelling in doc string.Guido van Rossum1997-06-021-1/+1
|
* Added dict.absorb() and dict.copy().Guido van Rossum1997-05-281-6/+70
|
* PyObject_Compare can raise an exception now.Guido van Rossum1997-05-233-22/+40
|
* PyObject_Compare can now return an error. Unfortunately, there are aGuido van Rossum1997-05-231-0/+8
| | | | | few places where we don't know how to test for them without losing speed; don't know yet how to handle that.
* PyFile_WriteString now returns an error indicator instead of callingGuido van Rossum1997-05-221-12/+18
| | | | PyErr_Clear().
* Fix typo in error checking spotted by Just...Guido van Rossum1997-05-221-1/+1
|
* 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.
* Moved PyObject_{Get,Set}Attr to object.c.Guido van Rossum1997-05-201-33/+2
| | | | Fixed two 'return NULL' that should be 'return -1'.
* Moved PyObject_{Get,Set}Attr here (from dictobject) and add PyObject_HasAttr.Guido van Rossum1997-05-201-0/+43
|