summaryrefslogtreecommitdiffstats
path: root/Include/listobject.h
Commit message (Collapse)AuthorAgeFilesLines
* #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and ↵Christian Heimes2007-12-191-3/+3
| | | | Py_REFCNT. Macros for b/w compatibility are available.
* PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis2007-07-211-3/+3
| | | | | backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
* Variation of patch # 1624059 to speed up checking if an object is a subclassNeal Norwitz2007-02-251-1/+2
| | | | | | | | | | | | | | | | | | of some of the common builtin types. Use a bit in tp_flags for each common builtin type. Check the bit to determine if any instance is a subclass of these common types. The check avoids a function call and O(n) search of the base classes. The check is done in the various Py*_Check macros rather than calling PyType_IsSubtype(). All the bits are set in tp_flags when the type is declared in the Objects/*object.c files because PyType_Ready() is not called for all the types. Should PyType_Ready() be called for all types? If so and the change is made, the changes to the Objects/*object.c files can be reverted (remove setting the tp_flags). Objects/typeobject.c would also have to be modified to add conditions for Py*_CheckExact() in addition to each the PyType_IsSubtype check.
* Merge ssize_t branch.Martin v. Löwis2006-02-151-8/+8
|
* Wrote down the invariants of some common objects whose structure isArmin Rigo2004-10-281-0/+3
| | | | | | | | | | exposed in header files. Fixed a few comments in these headers. As we might have expected, writing down invariants systematically exposed a (minor) bug. In this case, function objects have a writeable func_code attribute, which could be set to code objects with the wrong number of free variables. Calling the resulting function segfaulted the interpreter. Added a corresponding test.
* Fix typo in commentNeal Norwitz2004-08-011-1/+1
|
* * drop the unreasonable list invariant that ob_item should never come backArmin Rigo2004-07-291-3/+1
| | | | | | | | | | | | | | | | | | | | | to NULL during the lifetime of the object. * listobject.c nevertheless did not conform to the other invariants, either; fixed. * listobject.c now uses list_clear() as the obvious internal way to clear a list, instead of abusing list_ass_slice() for that. It makes it easier to enforce the invariant about ob_item == NULL. * listsort() sets allocated to -1 during sort; any mutation will set it to a value >= 0, so it is a safe way to detect mutation. A negative value for allocated does not cause a problem elsewhere currently. test_sort.py has a new test for this fix. * listsort() leak: if items were added to the list during the sort, AND if these items had a __del__ that puts still more stuff into the list, then this more stuff (and the PyObject** array to hold them) were overridden at the end of listsort() and never released.
* Fix obscure breakage (relative to 2.3) in listsort: the test for listTim Peters2004-07-291-0/+3
| | | | | | | | | | | | mutation during list.sort() used to rely on that listobject.c always NULL'ed ob_item when ob_size fell to 0. That's no longer true, so the test for list mutation during a sort is no longer reliable. Changed the test to rely instead on that listobject.c now never NULLs-out ob_item after (if ever) ob_item gets a non-NULL value. This new assumption is also documented now, as a required invariant in listobject.h. The new assumption allowed some real simplification to some of the hairier code in listsort(), so is a Good Thing on that count.
* Document what the members of PyListObject are used for, and the crucialTim Peters2004-07-291-0/+9
| | | | invariants they must satisfy.
* Eliminate a big block of duplicate code in PySequence_List() byRaymond Hettinger2004-03-111-0/+1
| | | | exposing _PyList_Extend().
* * Optimized list appends and pops by making fewer calls the underlying systemRaymond Hettinger2004-02-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | realloc(). This is achieved by tracking the overallocation size in a new field and using that information to skip calls to realloc() whenever possible. * Simplified and tightened the amount of overallocation. For larger lists, this overallocates by 1/8th (compared to the previous scheme which ranged between 1/4th to 1/32nd over-allocation). For smaller lists (n<6), the maximum overallocation is one byte (formerly it could be upto eight bytes). This saves memory in applications with large numbers of small lists. * Eliminated the NRESIZE macro in favor of a new, static list_resize function that encapsulates the resizing logic. Coverting this back to macro would give a small (under 1%) speed-up. This was too small to warrant the loss of readability, maintainability, and de-coupling. * Some functions using NRESIZE had grown unnecessarily complex in their efforts to bend to the macro's calling pattern. With the new list_resize function in place, those other functions could be simplified. That is being saved for a separate patch. * The ob_item==NULL check could be eliminated from the new list_resize function. This would entail finding each piece of code that sets ob_item to NULL and adding a new line to invalidate the overallocation tracking field. Rather than impose a new requirement on other pieces of list code, it was preferred to leave the NULL check in place and retain the benefits of decoupling, maintainability and information hiding (only PyList_New() and list_sort() need to know about the new field). This approach also reduces the odds of breaking an extension module. (Collaborative effort by Raymond Hettinger, Hye-Shik Chang, Tim Peters, and Armin Rigo.)
* Revert improvement to list.append() checked in before it was ready.Raymond Hettinger2004-02-081-1/+0
|
* Let reversed() work with itself.Raymond Hettinger2004-02-081-0/+1
|
* Excise DL_EXPORT from Include.Mark Hammond2002-08-121-12/+12
| | | | Thanks to Skip Montanaro and Kalle Svensson for the patches.
* Introduced the oddly-missing PyList_CheckExact(), and used it to replaceTim Peters2001-10-051-0/+1
| | | | a hard-coded type check.
* Merge of descr-branch back into trunk.Tim Peters2001-08-021-1/+1
|
* REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum2000-09-011-9/+0
| | | | This should match the situation in the 1.6b1 tree.
* ANSI-fication and Py_PROTO extermination.Fred Drake2000-07-091-19/+19
|
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-21/+6
|
* Got rid of silly "123456789-..." lines in comments.Guido van Rossum2000-03-011-2/+0
|
* Add DL_IMPORT(returntype) for all officially exported functions.Guido van Rossum1998-12-041-11/+11
|
* Fred's right -- we need PyList_SET_ITEM().Guido van Rossum1998-04-241-0/+1
|
* added PyList_GET_SIZE macroBarry Warsaw1997-01-061-1/+2
| | | | | for both PyList_GET_SIZE and PyList_GET_ITEM, cast first argument to a PyListObject*
* New permission notice, includes CNRI.Guido van Rossum1996-10-251-13/+20
|
* make the type a parameter of the DL_IMPORT macro, for Borland CGuido van Rossum1995-02-271-1/+1
|
* corrected two unconverted namesGuido van Rossum1995-01-201-1/+1
|
* new names for lots of new functionsGuido van Rossum1995-01-171-0/+1
|
* The great renaming, phase two: all header files have been updated toGuido van Rossum1995-01-121-18/+18
| | | | | | | use the new names exclusively, and the linker will see the new names. Files that import "Python.h" also only see the new names. Files that import "allobjects.h" will continue to be able to use the old names, due to the inclusion (in allobjects.h) of "rename2.h".
* Added 1995 copyright.Guido van Rossum1995-01-041-2/+2
| | | | | | object.h: made sizes and refcnts signed ints. stringobject.h: make getstrsize() signed int. methodobject.h: add METH_VARARGS and METH_FREENAME flag bit definitions.
* Changes for dynamic linking under NTGuido van Rossum1994-08-181-1/+1
|
* Merge alpha100 branch back to main trunkGuido van Rossum1994-08-011-1/+2
|
* * Added support for X11 modules.Guido van Rossum1993-07-281-0/+11
| | | | | | | * Makefile: change location of FORMS library. * posixmodule.c: turn #if 0 into #ifdef MSDOS (stuff in unistd.h or not) * Almost all .h files: added CPP magic to avoid duplicate inclusions and to support inclusion from C++.
* * Added gmtime/localtime/mktime and SYSV timezone globals to timemodule.c.Guido van Rossum1993-06-171-0/+2
| | | | | | | | | | Added $(SYSDEF) to its build rule in Makefile. * cgensupport.[ch], modsupport.[ch]: removed some old stuff. Also changed files that still used it... And made several things static that weren't but should have been... And other minor cleanups... * listobject.[ch]: add external interfaces {set,get}listslice * socketmodule.c: fix bugs in new send() argument parsing. * sunaudiodevmodule.c: added flush() and close().
* * Changed all copyright messages to include 1993.Guido van Rossum1993-03-291-2/+2
| | | | | | | | | | | | | | | | | * 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
* Copyright for 1992 addedGuido van Rossum1992-04-051-1/+1
|
* Added copyright notice.Guido van Rossum1991-02-191-0/+24
|
* "Compiling" versionGuido van Rossum1990-12-201-0/+8
|
* Added prototype for sortlist().Guido van Rossum1990-10-301-0/+1
|
* Initial revisionGuido van Rossum1990-10-141-0/+26