summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
Commit message (Collapse)AuthorAgeFilesLines
* When comparing objects, always check that tp_compare is not NULLGuido van Rossum1998-07-211-3/+7
| | | | | | before calling it. This check was there when the objects were of the same type *before* coercion, but not if they initially differed but became the same *after* coercion.
* 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 "".
* In PyObject_IsTrue(), don't call function pointers that are NULLGuido van Rossum1998-05-221-3/+6
| | | | (nb_nonzero, mp_length, sq_length).
* 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)
* 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.
* Add implementations of Py_Repr{Enter,Leave}.Guido van Rossum1998-04-101-0/+64
| | | | (Jeremy will hardly recognize his patch :-)
* Add PyObject_Not().Guido van Rossum1998-04-091-0/+14
|
* 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.
* 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.
* Fix mixup about PyErr_NoMemory() prototype.Guido van Rossum1997-08-121-4/+8
|
* 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).
* PyObject_Compare can raise an exception now.Guido van Rossum1997-05-231-15/+16
|
* Moved PyObject_{Get,Set}Attr here (from dictobject) and add PyObject_HasAttr.Guido van Rossum1997-05-201-0/+43
|
* Oops, another forgotten renaming: varobject -> PyVarObject.Guido van Rossum1997-05-151-5/+5
|
* Quickly renamed the last directory.Guido van Rossum1997-05-021-144/+145
|
* Intern the strings created in getattr() and setattr().Guido van Rossum1997-01-181-2/+2
|
* Make gcc -Wall happyGuido van Rossum1996-12-051-2/+2
|
* New permission notice, includes CNRI.Guido van Rossum1996-10-251-13/+20
|
* Correct typo in setattr: return -1 for error, not NULLGuido van Rossum1996-09-111-1/+1
|
* Define reference count admin debug functions to return void.Guido van Rossum1996-08-121-0/+4
|
* Support for tp_getattro, tp_setattro (Sjoerd)Guido van Rossum1996-08-091-0/+21
|
* Hacks for MS_COREDLLGuido van Rossum1996-07-211-0/+19
|
* rename printrefs, getobjects to _Py_ prefixGuido van Rossum1996-05-241-2/+2
|
* TRACE_REFS -> Py_TRACE_REFS.Guido van Rossum1996-05-221-1/+5
| | | | Added disgusting hack to force loading of abstract.o.
* Hack to force loading of cobject.oGuido van Rossum1996-01-121-0/+4
|
* Implemented two new functions in sys:Sjoerd Mullender1995-08-291-0/+58
| | | | | | | | | | | | getcounts() returns a list of counts of allocations and deallocations for all different object types. getobjects(n [, type ]) returns a list of recently allocated and not-yet-freed objects of the given type (all objects if no type given). Only the n most recent (all if n==0) objects are returned. getcounts is only available if compiled with -DCOUNT_ALLOCS, getobjects is only available if compiled with -DTRACE_REFS. Note that everything must be compiled with these options!
* args to call_object must be tuple or NULLGuido van Rossum1995-07-121-10/+4
|
* change in counting freed objectsGuido van Rossum1995-04-061-4/+4
|
* fix dusty debugging macrosGuido van Rossum1995-03-291-1/+1
|
* make size arg signedGuido van Rossum1995-02-101-1/+1
|
* move callable() hereGuido van Rossum1995-01-261-0/+29
|
* fix strobject() behaviorGuido van Rossum1995-01-171-2/+4
|
* properly implement cmp() for class instancesGuido van Rossum1995-01-121-0/+31
|
* move coerce() from bltinmodule.c to object.c and implement builtin_coerce() ↵Guido van Rossum1995-01-101-0/+33
| | | | differently
* attribute-less object is AttributeError, not TypeErrorGuido van Rossum1995-01-071-1/+1
|
* Added 1995 to copyright message.Guido van Rossum1995-01-041-2/+2
| | | | | floatobject.c: fix hash(). methodobject.c: support METH_FREENAME flag bit.
* Lots of minor changes. Note for mappingobject.c: the hash table pointerGuido van Rossum1995-01-021-13/+7
| | | | can now be NULL.
* rearranged code in debugging version of DELREF to avoid touching dataGuido van Rossum1994-09-071-1/+2
| | | | after it has been freed.
* Merge back to main trunkGuido van Rossum1994-08-301-8/+4
|
* * mpzmodule.c: removed redundant mpz_print function.Guido van Rossum1993-11-051-1/+35
| | | | | | | | | | | | | | * object.[ch], bltinmodule.c, fileobject.c: changed str() to call strobject() which calls an object's __str__ method if it has one. strobject() is also called by writeobject() when PRINT_RAW is passed. * ceval.c: rationalize code for PRINT_ITEM (no change in function!) * funcobject.c, codeobject.c: added compare and hash functionality. Functions with identical code objects and the same global dictionary are equal. Code objects are equal when their code, constants list and names list are identical (i.e. the filename and code name don't count). (hash doesn't work yet since the constants are in a list and lists can't be hashed -- suppose this should really be done with a tuple now we have resizetuple!)
* import.c: When something is wrong with the .pyc, properly open the .pySjoerd Mullender1993-10-251-8/+9
| | | | | file. object.c: Write allocation statistics to stderr.
* Several optimizations and speed improvements.Sjoerd Mullender1993-10-221-0/+2
| | | | cstubs: Use Matrix type instead of float[4][4].
* intobject.c: Save references to small integers, so that they can beSjoerd Mullender1993-10-151-2/+8
| | | | | | | | | | | | | | | | shared. The default is to save references to the integers in the range -1..99. The lower limit can be set by defining NSMALLNEGINTS (absolute value of smallest integer to be saved) and NSMALLPOSINTS (1 more than the largest integer to be saved). tupleobject.c: Save a reference to the empty tuple to be returned whenever a tuple of size 0 is requested. Tuples of size 1 upto, but not including, MAXSAVESIZE (default 20) are put in free lists when deallocated. When MAXSAVESIZE equals 1, only share references to the empty tuple, when MAXSAVESIZE equals 0, don't include the code at all and revert to the old behavior. object.c: Print some more statistics when COUNT_ALLOCS is defined.
* * Extended X interface: pixmap objects, colormap objects visual objects,Sjoerd Mullender1993-10-111-2/+38
| | | | | | | | image objects, and lots of new methods. * Added counting of allocations and deallocations of builtin types if COUNT_ALLOCS is defined. Had to move calls to NEWREF down in some files. * Bug fix in sorting lists.
* * accessobject.c (ownercheck): allow a base class access to protectedGuido van Rossum1993-07-111-0/+14
| | | | | | objects of its derived classes; allow anything that has an attribute named "__privileged__" access to anything. * object.[ch]: added hasattr() -- test whether getattr() will succeed.
* * pythonrun.c: Print exception type+arg *after* stack trace instead ofGuido van Rossum1993-05-121-0/+23
| | | | | | | before it. * ceval.c, object.c: moved testbool() to object.c (now extern visible) * stringobject.c: fix bugs in and rationalize string resize in formatstring() * tokenizer.[ch]: fix non-working code for lines longer than BUFSIZ
* * Changed all copyright messages to include 1993.Guido van Rossum1993-03-291-2/+17
| | | | | | | | | | | | | | | | | * 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
* * Makefile: added IMGFILE; moved some stuff around.Guido van Rossum1992-09-171-12/+1
| | | | | | | | * flmodule.c: added some missing functions; changed readonly flags of some data members based upon FORMS documentation. * listobject.c: fixed int/long arg lint bug (bites PC compilers). * several: removed redundant print methods (repr is good enough). * posixmodule.c: added (still experimental) process group functions.
* If a type has a repr function but no print function, printing it nowGuido van Rossum1992-09-031-5/+34
| | | | | | | | calls the repr function. When the refcount is bad, don't print the object at all (chances of crashes). Changes to checking and printing of references: the consistency check is somewhat faster; don't print strings referenced once (most occur in function's name lists).