summaryrefslogtreecommitdiffstats
path: root/Objects
Commit message (Collapse)AuthorAgeFilesLines
* Silence compiler warnings in VC 7.Jeremy Hylton2003-05-011-2/+2
|
* Squashed new compiler wngs about trying to compare pointers toTim Peters2003-04-242-2/+2
| | | | functions with different signatures.
* SF bug 665835: filter() treatment of str and tuple inconsistentRaymond Hettinger2003-04-242-0/+4
| | | | | | | | As a side issue on this bug, it was noted that list and tuple iterators used macros to directly access containers and would not recognize __getitem__ overrides. If the method is overridden, the patch returns a generic sequence iterator which calls the __getitem__ method; otherwise, it returns a high custom iterator with direct access to container elements.
* Improve the message about metatype/metaclass conflicts.Guido van Rossum2003-04-231-1/+4
|
* Add a useful docstring to enumerate.Jeremy Hylton2003-04-211-1/+6
|
* - bool() called without arguments now returns False rather thanGuido van Rossum2003-04-191-2/+2
| | | | | | | raising an exception. This is consistent with calling the constructors for the other builtin types -- called without argument they all return the false value of that type. (SF patch #724135) Thanks to Alex Martelli.
* _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().
* SF # 595026: support for masks in getargs.c.Thomas Heller2003-04-172-0/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New functions: unsigned long PyInt_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *); unsigned long PyLong_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); New and changed format codes: b unsigned char 0..UCHAR_MAX B unsigned char none ** h unsigned short 0..USHRT_MAX H unsigned short none ** i int INT_MIN..INT_MAX I * unsigned int 0..UINT_MAX l long LONG_MIN..LONG_MAX k * unsigned long none L long long LLONG_MIN..LLONG_MAX K * unsigned long long none Notes: * New format codes. ** Changed from previous "range-and-a-half" to "none"; the range-and-a-half checking wasn't particularly useful. New test test_getargs2.py, to verify all this.
* - The repr() of a weakref object now shows the __name__ attribute ofGuido van Rossum2003-04-161-6/+15
| | | | | | | the referenced object, if it has one. Also use %p to format pointers consistently, and use <weakproxy ...> in proxy_repr(), to match the type name.
* Sigh. The crucial change was still missing from the previousGuido van Rossum2003-04-161-1/+1
| | | | checkin. :-(
* - super() no longer ignores data descriptors, except __class__. SeeGuido van Rossum2003-04-161-4/+10
| | | | | the thread started at http://mail.python.org/pipermail/python-dev/2003-April/034338.html
* Fix three (!) object leaks in the code for assignment to __bases__.Guido van Rossum2003-04-151-1/+3
|
* Ouch, it's Carlo Verre, not Verre Carlo.Guido van Rossum2003-04-151-1/+1
|
* - 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.
* Close off the "Verre Carlo hack" as discussed on python-dev.Guido van Rossum2003-04-141-0/+22
|
* super_getattro(): kill some dead code; explain a mystery.Guido van Rossum2003-04-141-18/+4
|
* - list.insert(i, x) now interprets negative i as it would beGuido van Rossum2003-04-141-2/+5
| | | | | | interpreted by slicing, so negative values count from the end of the list. This was the only place where such an interpretation was not placed on a list index.
* Attempt to make all the various string *strip methods the same.Neal Norwitz2003-04-102-18/+18
| | | | | | | | | | | * Doc - add doc for when functions were added * UserString * string object methods * string module functions 'chars' is used for the last parameter everywhere. These changes will be backported, since part of the changes have already been made, but they were inconsistent.
* Missing DECREF.Jeremy Hylton2003-04-091-0/+1
|
* Make it possible to call instancemethod() with 2 arguments.Guido van Rossum2003-04-091-2/+2
|
* Reformat a few docstrings that caused line wraps in help() output.Guido van Rossum2003-04-092-12/+12
|
* property_traverse() should also traverse into prop_doc -- there's noGuido van Rossum2003-04-091-0/+1
| | | | | typecheck that guarantees it's a string, and BTW string subclasses could hide references.
* Make staticmethods and classmethods participate in GC.Jeremy Hylton2003-04-081-8/+45
| | | | | | | | | | If a class was defined inside a function, used a static or class method, and used super() inside the method body, it would be caught in an uncollectable cycle. (Simplified version: The static/class method object would point to a function object with a closure that referred to the class.) Bugfix candidate.
* New private API function _PyInstance_Lookup. gc will use this to figureTim Peters2003-04-071-0/+21
| | | | out whether __del__ exists, without executing any Python-level code.
* SF bug #699934: Obscure error messageRaymond Hettinger2003-04-061-4/+2
| | | | | mwh pointed out that the error message did not make sense if obtained by rearranging the bases.
* Change formatchar(), so that u"%c" % 0xffffffff now raisesWalter Dörwald2003-04-021-2/+2
| | | | | an OverflowError instead of a TypeError to be consistent with "%c" % 256. See SF patch #710127.
* Fix PyString_Format() so that '%c' % u'a' returns u'a'Walter Dörwald2003-03-311-0/+7
| | | | | | | | instead of raising a TypeError. (From SF patch #710127) Add tests to verify this is fixed. Add various tests for '%c' % int.
* Rename LONG_LONG to PY_LONG_LONG. Fixes #710285.Martin v. Löwis2003-03-291-22/+22
|
* Refactoring: rename update_these_slots() into update_subclasses() andGuido van Rossum2003-03-241-47/+68
| | | | | generalize to take a callback function and a void * data argument. This might come in handy later... :-)
* Typo in comment.Tim Peters2003-03-231-1/+1
|
* Improved new Py_TRACE_REFS gimmicks.Tim Peters2003-03-232-18/+37
| | | | | | | | | | | Arranged that all the objects exposed by __builtin__ appear in the list of all objects. I basically peed away two days tracking down a mystery leak in sys.gettotalrefcount() in a ZODB app (== tons of code), because the object leaking the references didn't appear in the sys.getobjects(0) list. The object happened to be False. Now False is in the list, along with other popular & previously missing leak candidates (like None). Alas, we still don't have a choke point covering *all* Python objects, so the list of all objects may still be incomplete.
* slot_sq_contains(): This leaked a reference to the result of callingTim Peters2003-03-231-11/+12
| | | | | | __contains__(). Bugfix candidate.
* Refactored some of the Py_TRACE_REFS code. New private API functionTim Peters2003-03-232-10/+26
| | | | | | | _Py_AddToAllObjects() that simply inserts an object at the front of the doubly-linked list of all objects. Changed PyType_Ready() (the closest thing we've got to a choke point for type objects) to call that.
* Oops! Used a wrong preprocessor symbol.Tim Peters2003-03-231-1/+1
|
* When Py_TRACE_REFS is defined, a list of all live objects is maintained inTim Peters2003-03-231-2/+15
| | | | | | | | | | | a doubly-linked list, exposed by sys.getobjects(). Unfortunately, it's not really all live objects, and it seems my fate to bump into programs where sys.gettotalrefcount() keeps going up but where the reference leaks aren't accounted for by anything in the list of all objects. This patch helps a little: if COUNT_ALLOCS is also defined, from now on type objects will also appear in this list, provided at least one object of a type has been allocated.
* _PyFloat_Pack4(): Removed needless call of floor().Tim Peters2003-03-211-1/+1
|
* New private API functions _PyFloat_{Pack,Unpack}(4,8}. This is aTim Peters2003-03-201-0/+313
| | | | | refactoring to get all the duplicates of this delicate code out of the cPickle and struct modules.
* Renamed PyObject_GenericGetIter to PyObject_SelfIterRaymond Hettinger2003-03-177-8/+8
| | | | | | to more accurately describe what the function does. Suggested by Thomas Wouters.
* Created PyObject_GenericGetIter().Raymond Hettinger2003-03-177-51/+14
| | | | Factors out the common case of returning self.
* SF bug #699934: Obscure error messageRaymond Hettinger2003-03-121-1/+4
| | | | Clarify error message for mro conflicts.
* Sf patch #700047: unicode object leaks refcount on resizingRaymond Hettinger2003-03-091-0/+1
| | | | Contributed by Hye-Shik Chang.
* - The extended type structure used for heap types (new-styleGuido van Rossum2003-03-071-49/+34
| | | | | classes defined by Python code using a class statement) is now exported from object.h as PyHeapTypeObject. (SF patch #696193.)
* SF patch #693753: fix for bug 639806: default for dict.popRaymond Hettinger2003-03-061-3/+15
| | | | (contributed by Michael Stone.)
* Fix from Greg Chapman from SF bug #695651: a complex subclassGuido van Rossum2003-03-021-2/+3
| | | | | | | | | | | | | | constructor, when passed a single complex argument, returns the argument unchanged. This should be done only for the complex base class; a complex subclass should of course cast the value to the subclass in this case. The fix also revealed a segfault in complex_getnewargs(): the argument for the Py_BuildValue() format code "D" is the *address* of a Py_complex struct, not the value. (This corroborated by the API documentation.) I expect this needs to be backported to 2.2.3.
* Removed duplicate test from inner loop.Raymond Hettinger2003-03-011-6/+1
| | | | The PyIter_Check is already performed by PyObject_GetIter.
* Fix SF bug #689659, 64-bit int and long hash keys incompatibleNeal Norwitz2003-02-231-2/+4
| | | | | On a 64-bit machine, a dictionary could contain duplicate int/long keys if the value was > 2**32.
* Implementing the salient parts of __reduce_ex__ in C.Guido van Rossum2003-02-211-6/+229
| | | | | | | This still falls back to helpers in copy_reg for: - pickle protocols < 2 - calculating the list of slot names (done only once per class) - the __newobj__ function (which is used as a token but never called)
* Strange control flow in PyInt_AsLong. When nb_int is called insideThomas Heller2003-02-201-3/+3
| | | | | | | | the PyInt_AsLong function, and this returns a long, the value is first retrieved with PyLong_AsLong, but afterwards overwritten by a call to PyInt_AS_LONG. Fixes SF #690253.
* PyObject_Generic{Get,Set}Attr:Guido van Rossum2003-02-191-2/+4
| | | | | | | | | | Don't access tp_descr_{get,set} of a descriptor without checking the flag bits of the descriptor's type. While we know that the main type (the type of the object whose attribute is being accessed) has all the right flag bits (or else PyObject_Generic{Get,Set}Attr wouldn't be called), we don't know that for its class attributes! Will backport to 2.2.