summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
Commit message (Collapse)AuthorAgeFilesLines
* #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and ↵Christian Heimes2007-12-191-34/+34
| | | | Py_REFCNT. Macros for b/w compatibility are available.
* Backport of _abccoll.py by Benjamin Arangueren, issue 1383.Guido van Rossum2007-11-221-1/+1
| | | | With some changes of my own thrown in (e.g. backport of r58107).
* tuple.__repr__ did not consider a reference loop as it is not possible fromBrett Cannon2007-09-301-0/+5
| | | | | | | | | | Python code; but it is possible from C. object.__str__ had the issue of not expecting a type to doing something within it's tp_str implementation that could trigger an infinite recursion, but it could in C code.. Both found thanks to BaseException and how it handles its repr. Closes issue #1686386. Thanks to Thomas Herve for taking an initial stab at coming up with a solution.
* Add a bunch of GIL release/acquire points in tp_print implementations and forBrett Cannon2007-09-171-0/+4
| | | | | | PyObject_Print(). Closes issue #1164.
* PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis2007-07-211-40/+40
| | | | | backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
* Add -3 option to the interpreter to warn about features that areNeal Norwitz2007-05-231-0/+1
| | | | | | | deprecated and will be changed/removed in Python 3.0. This patch is mostly from Anthony. I tweaked some format and added a little doc.
* Remove warning: funcion declaration isn't a prototypeJeremy Hylton2007-03-161-2/+1
|
* Typo and grammar fixes.Georg Brandl2007-03-131-3/+3
|
* Backport from Py3k branch:Georg Brandl2007-03-121-96/+169
| | | | | | | Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir. Had to change a few bits of the patch because classobjs and __methods__ are still in Py2.6.
* Slightly revised version of patch #1538956:Marc-André Lemburg2006-08-141-17/+0
| | | | | | | | | | Replace UnicodeDecodeErrors raised during == and != compares of Unicode and other objects with a new UnicodeWarning. All other comparisons continue to raise exceptions. Exceptions other than UnicodeDecodeErrors are also left untouched.
* Patch #1507676: improve exception messages in abstract.c, object.c and ↵Georg Brandl2006-06-181-12/+18
| | | | typeobject.c.
* Correct some value converting strangenesses.Georg Brandl2006-05-291-1/+1
|
* Comment typo fixAndrew M. Kuchling2006-04-181-1/+1
|
* Remove types from type_list if they have no objectsMartin v. Löwis2006-04-181-6/+33
| | | | | and unlist_types_without_objects is set. Give dump_counts a FILE* argument.
* spread the extern "C" { } magic pixie dust around. Python itself builds nowAnthony Baxter2006-04-131-0/+9
| | | | | using a C++ compiler. Still lots and lots of errors in the modules built by setup.py, and a bunch of warnings from g++ in the core.
* Ignore the references to the dummy objects used as deleted keysArmin Rigo2006-04-121-1/+18
| | | | in dicts and sets when computing the total number of references.
* _Py_PrintReferenceAddresses,_Py_PrintReferences:Tim Peters2006-04-111-7/+3
| | | | | | | | | | interpolate PY_FORMAT_SIZE_T for refcount display instead of casting refcounts to long. I understand that gcc on some boxes delivers nuisance warnings about this, but if any new ones appear because of this they'll get fixed by magic when the others get fixed.
* Remove unnecessary casts in type object initializers.Georg Brandl2006-03-301-4/+4
|
* Fixed bug #1459029 - unicode reprs were double-escaped.Anthony Baxter2006-03-301-1/+1
| | | | Backed out an old patch from 2000.
* Heh -- used the right format for a refcount, but forgotTim Peters2006-03-231-1/+1
| | | | to stop truncating it.
* _Py_NegativeRefcount(): print the full value of ob_refcnt.Tim Peters2006-03-231-3/+2
|
* Fix and test (manually w/xx module) passing NULLs to PyObject_Str() andNeal Norwitz2006-03-141-5/+7
| | | | | | | | | | | | | PyObject_Unicode(). This problem was originally reported from Coverity and addresses mail on python-dev "checkin r43015". This inlines the conversion of the string to unicode and cleans up/simplifies some code at the end of the PyObject_Unicode(). We really need a complete C API test module for all public APIs and passing good and bad parameter values. Will backport.
* Fix bug found by Coverity: don't allow NULL argument to PyUnicode_CheckExactGeorg Brandl2006-03-131-2/+2
|
* Change int to Py_ssize_t in several places.Martin v. Löwis2006-03-071-2/+2
| | | | | Add (int) casts to silence compiler warnings. Raise Python exceptions for overflows.
* Oops, forgot to include this in the last checkin.Neal Norwitz2006-03-041-1/+1
| | | | Actually define Py_RefTotal as a Py_ssize_t.
* Use %ld and casts to long for refcount printing, in absense of a universallyThomas Wouters2006-03-011-8/+18
| | | | | available %zd format character. Mark with an XXX comment so we can fix this, later.
* Revert backwards-incompatible const changes.Martin v. Löwis2006-02-271-2/+2
|
* Merge ssize_t branch.Martin v. Löwis2006-02-151-11/+12
|
* Add const to several API functions that take char *.Jeremy Hylton2005-12-101-5/+5
| | | | | | | | | | | | | | | | | | | In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
* Change the %s format specifier for str objects so that it returns aNeil Schemenauer2005-08-121-9/+29
| | | | | unicode instance if the argument is not an instance of basestring and calling __str__ on the argument returns a unicode instance.
* Make subclasses of int, long, complex, float, and unicode perform typeBrett Cannon2005-04-261-25/+24
| | | | | | | conversion using the proper magic slot (e.g., __int__()). Also move conversion code out of PyNumber_*() functions in the C API into the nb_* function. Applied patch #1109424. Thanks Walter Doewald.
* Dima Dorfman's patch for coercion/comparison of C types (patch #995939), withArmin Rigo2004-12-231-16/+11
| | | | | a minor change after the coercion, to accept two objects not necessarily of the same type but with the same tp_compare.
* Remove 'extern' declaration for _Py_SwappedOp.Brett Cannon2004-09-251-1/+1
|
* A static swapped_op[] array was defined in 3 different C files, & I thinkTim Peters2004-09-231-4/+4
| | | | | I need to define it again. Bite the bullet and define it once as an extern, _Py_SwappedOp[].
* Move a comment back to its rightful location.Michael W. Hudson2004-09-141-2/+2
|
* SF bug #1004669: Type returned from .keys() is not checkedRaymond Hettinger2004-08-071-0/+5
|
* Remove unused macros in .c filesNeal Norwitz2004-07-081-2/+0
|
* Make weak references subclassable:Fred Drake2004-07-021-0/+3
| | | | | | | | | | | | | | | | | | | | | | - weakref.ref and weakref.ReferenceType will become aliases for each other - weakref.ref will be a modern, new-style class with proper __new__ and __init__ methods - weakref.WeakValueDictionary will have a lighter memory footprint, using a new weakref.ref subclass to associate the key with the value, allowing us to have only a single object of overhead for each dictionary entry (currently, there are 3 objects of overhead per entry: a weakref to the value, a weakref to the dictionary, and a function object used as a weakref callback; the weakref to the dictionary could be avoided without this change) - a new macro, PyWeakref_CheckRefExact(), will be added - PyWeakref_CheckRef() will check for subclasses of weakref.ref This closes SF patch #983019.
* SF Bug #215126: Over restricted type checking on eval() functionRaymond Hettinger2004-07-021-1/+1
| | | | | | The builtin eval() function now accepts any mapping for the locals argument. Time sensitive steps guarded by PyDict_CheckExact() to keep from slowing down the normal case. My timings so no measurable impact.
* Two new public API functions, Py_IncRef and Py_DecRef. Useful forThomas Heller2004-04-221-0/+12
| | | | dynamic embedders of Python.
* Fix typo in comment.Raymond Hettinger2004-03-211-1/+1
|
* Add identity shortcut to PyObject_RichCompareBool.Raymond Hettinger2004-03-211-1/+11
|
* Removed two unneeded lines from PyObject_Compare().Brett Cannon2004-01-271-2/+0
| | | | Closes bug #885293 (thanks, Josiah Carlson).
* Getting rid of all the code inside #ifdef macintosh too.Jack Jansen2003-11-201-4/+0
|
* Getting rid of support for the ancient Apple MPW compiler.Jack Jansen2003-11-191-8/+0
|
* Deleting cyclic object comparison.Armin Rigo2003-10-281-180/+8
| | | | | SF patch 825639 http://mail.python.org/pipermail/python-dev/2003-October/039445.html
* Fix forMichael W. Hudson2003-08-151-1/+6
| | | | | | | | | [ 784825 ] fix obscure crash in descriptor handling Should be applied to release23-maint and in all likelyhood release22-maint, too. Certainly doesn't apply to release21-maint.
* _Py_PrintReferenceAddresses(): also print the type name. In real useTim Peters2003-04-181-1/+2
| | | | | | | | | I'm finding some pretty baffling output, like reprs consisting entirely of three left parens. At least this will let us know what type the object is (it's not str -- there's no quote character in the repr). New tool combinerefs.py, to combine the two output blocks produced via PYTHONDUMPREFS.
* _Py_PrintReferences(): Changed to print object address at start of eachTim Peters2003-04-171-1/+16
| | | | | | | | | | | | | | | new line. New pvt API function _Py_PrintReferenceAddresses(): Prints only the addresses and refcnts of the live objects. This is always safe to call, because it has no dependence on Python's C API. Py_Finalize(): If envar PYTHONDUMPREFS is set, call (the new) _Py_PrintReferenceAddresses() right before dumping final pymalloc stats. We can't print the reprs of the objects here because too much of the interpreter has been shut down. You need to correlate the addresses displayed here with the object reprs printed by the earlier PYTHONDUMPREFS call to _Py_PrintReferences().
* - pythunrun.c, Py_Finalize(): move the call to _Py_PrintReferences()Guido van Rossum2003-04-151-1/+1
| | | | | | | | | | | | | | | | | | | even farther down, to just before the call to _PyObject_DebugMallocStats(). This required the following changes: - pystate.c, PyThreadState_GetDict(): changed not to raise an exception or issue a fatal error when no current thread state is available, but simply return NULL without raising an exception (ever). - object.c, Py_ReprEnter(): when PyThreadState_GetDict() returns NULL, don't raise an exception but return 0. This means that when printing a container that's recursive, printing will go on and on and on. But that shouldn't happen in the case we care about (see first bullet). - Updated Misc/NEWS and Doc/api/init.tex to reflect changes to PyThreadState_GetDict() definition.