summaryrefslogtreecommitdiff
path: root/Include/objimpl.h
AgeCommit message (Collapse)AuthorLines
2010-12-03Merge branches/pep-0384.Martin v. Löwis-1/+2
2010-05-09Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou-72/+72
svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........
2009-09-28http://bugs.python.org/issue6836Kristján Valur Jónsson-0/+7
Merging revisions 75103,75104 from trunk to py3k
2009-03-23Merged revisions 70546 via svnmerge fromAntoine Pitrou-0/+11
svn+ssh://pythondev@svn.python.org/python/trunk ........ r70546 | antoine.pitrou | 2009-03-23 19:41:45 +0100 (lun., 23 mars 2009) | 9 lines Issue #4688: Add a heuristic so that tuples and dicts containing only untrackable objects are not tracked by the garbage collector. This can reduce the size of collections and therefore the garbage collection overhead on long-running programs, depending on their particular use of datatypes. (trivia: this makes the "binary_trees" benchmark from the Computer Language Shootout 40% faster) ........
2007-12-19#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.Christian Heimes-5/+5
2007-08-19Remove _PyObject_DelNeal Norwitz-3/+0
2007-07-21Merged revisions 56467-56482 via svnmerge fromMartin v. Löwis-5/+5
svn+ssh://pythondev@svn.python.org/python/branches/p3yk ................ r56477 | martin.v.loewis | 2007-07-21 09:04:38 +0200 (Sa, 21 Jul 2007) | 11 lines Merged revisions 56466-56476 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r56476 | martin.v.loewis | 2007-07-21 08:55:02 +0200 (Sa, 21 Jul 2007) | 4 lines PEP 3123: Provide forward compatibility with Python 3.0, while keeping backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT. ........ ................ r56478 | martin.v.loewis | 2007-07-21 09:47:23 +0200 (Sa, 21 Jul 2007) | 2 lines PEP 3123: Use proper C inheritance for PyObject. ................ r56479 | martin.v.loewis | 2007-07-21 10:06:55 +0200 (Sa, 21 Jul 2007) | 3 lines Add longintrepr.h to Python.h, so that the compiler can see that PyFalse is really some kind of PyObject*. ................ r56480 | martin.v.loewis | 2007-07-21 10:47:18 +0200 (Sa, 21 Jul 2007) | 2 lines Qualify SHIFT, MASK, BASE. ................ r56482 | martin.v.loewis | 2007-07-21 19:10:57 +0200 (Sa, 21 Jul 2007) | 2 lines Correctly refer to _ob_next. ................
2006-07-27Get rid of most of the flags (in tp_flags) that keep track of variousGuido van Rossum-3/+1
variations of the type struct and its attachments. In Py3k, all type structs have to have all fields -- no binary backwards compatibility. Had to change the complex object to a new-style number!
2006-04-21Merge p3yk branch with the trunk up to revision 45595. This breaks a fairThomas Wouters-13/+9
number of tests, all because of the codecs/_multibytecodecs issue described here (it's not a Py3K issue, just something Py3K discovers): http://mail.python.org/pipermail/python-dev/2006-April/064051.html Hye-Shik Chang promised to look for a fix, so no need to fix it here. The tests that are expected to break are: test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecs test_multibytecodec This merge fixes an actual test failure (test_weakref) in this branch, though, so I believe merging is the right thing to do anyway.
2006-03-04Make PyGC_Collect() use Py_ssize_t.Neal Norwitz-1/+1
2006-03-01Change GC refcount to Py_ssize_t.Martin v. Löwis-1/+1
2006-02-16Change _PyObject_GC_Resize to expect Py_ssize_t.Martin v. Löwis-1/+1
2006-02-15Merge ssize_t branch.Martin v. Löwis-3/+3
2006-01-26Fix PyGC_Collect() to be exported from the built DLL on Windows. (Fix givenBarry Warsaw-1/+1
by Matt Messier).
2005-07-22[ 1243081 ] repair typosGeorg Brandl-1/+1
2004-07-15Formalize that the Py_VISIT macro requires that the tp_traverseTim Peters-1/+5
implementation it's used in must give its arguments specific names.
2004-07-14Documented the new Py_VISIT macro to simplify implementation ofJim Fulton-0/+10
tp_traverse handlers. (Tim made me do it. ;)
2003-04-17- New C API PyGC_Collect(), same as calling gc.collect().Guido van Rossum-0/+3
- Call this in Py_Finalize(). - Expand the Misc/NEWS text on PY_LONG_LONG.
2002-08-12Excise DL_EXPORT from Include.Mark Hammond-20/+20
Thanks to Skip Montanaro and Kalle Svensson for the patches.
2002-07-07Removed WITH_CYCLE_GC #ifdef-ery. Holes:Tim Peters-19/+0
+ I'm not sure what to do about configure.in. Left it alone. + Ditto pyexpat.c. Fred or Martin will know what to do.
2002-07-02Finished transitioning to using gc_refs to track gc objects' states.Tim Peters-3/+5
This was mostly a matter of adding comments and light code rearrangement. Upon untracking, gc_next is still set to NULL. It's a cheap way to provoke memory faults if calling code is insane. It's also used in some way by the trashcan mechanism.
2002-07-02Reserved another gc_refs value for untracked objects. Every live gcTim Peters-2/+10
object should now have a well-defined gc_refs value, with clear transitions among gc_refs states. As a result, none of the visit_XYZ traversal callbacks need to check IS_TRACKED() anymore, and those tests were removed. (They were already looking for objects with specific gc_refs states, and the gc_refs state of an untracked object can no longer match any other gc_refs state by accident.) Added more asserts. I expect that the gc_next == NULL indicator for an untracked object is now redundant and can also be removed, but I ran out of time for this.
2002-05-04_PyGC_generation0 is now a pointerNeil Schemenauer-4/+4
2002-04-28Moving pymalloc along.Tim Peters-69/+83
As threatened, PyMem_{Free, FREE} also invoke the object deallocator now when pymalloc is enabled (well, it does when pymalloc isn't enabled too, but in that case "the object deallocator" is plain free()). This is maximally backward-compatible, but it leaves a bitter aftertaste. Also massive reworking of comments.
2002-04-13_PyObject_DebugDumpStats: renamed to _PyObject_DebugMallocStats.Tim Peters-1/+1
Added code to call this when PYMALLOC_DEBUG is enabled, and envar PYTHONMALLOCSTATS is set, whenever a new arena is obtained and once late in the Python shutdown process.
2002-04-12First cut at repairing out-of-date comments; make alignment of macro defsTim Peters-15/+24
all the same within the #ifdef WITH_PYMALLOC block.
2002-04-12Remove PyMalloc_* symbols. PyObject_Malloc now uses pymalloc ifNeil Schemenauer-38/+44
it's enabled. Allow PyObject_Del, PyObject_Free, and PyObject_GC_Del to be used as function designators. Provide source compatibility macros. Make PyObject_GC_Track and PyObject_GC_UnTrack functions instead of trivial macros wrapping functions.
2002-03-28Add _Py_AS_GC macro. It will be used by the trashcan code on object.c.Neil Schemenauer-2/+4
2002-03-22Make PyObject_{NEW,New,Del,DEL} always use the standard malloc (PyMem_*)Neil Schemenauer-8/+23
and not pymalloc. Add the functions PyMalloc_New, PyMalloc_NewVar, and PyMalloc_Del that will use pymalloc if it's enabled. If pymalloc is not enabled then they use the standard malloc (PyMem_*).
2002-03-18Drop the PyCore_* memory API.Neil Schemenauer-45/+8
2002-03-18Simpilify PyCore_* macros by assuming the function prototypes forNeil Schemenauer-29/+9
malloc() and free() don't change.
2002-02-28PyGC_Head: Use "long double" instead of "double" as the worst-caseTim Peters-1/+1
alignment gimmick. David Abrahams notes that the standard "long double" actually requires stricter alignment than "double" on some Tru64 box. On my box and yours <wink>, it's the same, so no harm done on most boxes.
2001-10-11SF bug [#467145] Python 2.2a4 build problem on HPUX 11.0.Tim Peters-12/+15
The platform requires 8-byte alignment for doubles, but the GC header was 12 bytes and that threw off the natural alignment of the double members of a subtype of complex. The fix puts the GC header into a union with a double as the other member, to force no-looser-than double alignment of GC headers. On boxes that require 8-byte alignment for doubles, this may add pad bytes to the GC header accordingly; ditto for platforms that *prefer* 8-byte alignment for doubles. On platforms that don't care, it shouldn't change the memory layout (because the size of the old GC header is certainly greater than the size of a double on all platforms, so unioning with a double shouldn't change size or alignment on such boxes).
2001-10-07Guido suggests, and I agree, to insist that SIZEOF_VOID_P be a power of 2.Tim Peters-27/+23
This simplifies the rounding in _PyObject_VAR_SIZE, allows to restore the pre-rounding calling sequence, and allows some nice little simplifications in its callers. I'm still making it return a size_t, though.
2001-10-06_PyObject_VAR_SIZE: always round up to a multiple-of-pointer-size value.Tim Peters-11/+35
As Guido suggested, this makes the new subclassing code substantially simpler. But the mechanics of doing it w/ C macro semantics are a mess, and _PyObject_VAR_SIZE has a new calling sequence now. Question: The PyObject_NEW_VAR macro appears to be part of the public API. Regardless of what it expands to, the notion that it has to round up the memory it allocates is new, and extensions containing the old PyObject_NEW_VAR macro expansion (which was embedded in the PyObject_NEW_VAR expansion) won't do this rounding. But the rounding isn't actually *needed* except for new-style instances with dict pointers after a variable-length blob of embedded data. So my guess is that we do not need to bump the API version for this (as the rounding isn't needed for anything an extension can do unless it's recompiled anyway). What's your guess?
2001-10-06Repaired the debug Windows deaths in test_descr, by allocating enoughTim Peters-1/+2
pad memory to properly align the __dict__ pointer in all cases. gcmodule.c/objimpl.h, _PyObject_GC_Malloc: + Added a "padding" argument so that this flavor of malloc can allocate enough bytes for alignment padding (it can't know this is needed, but its callers do). typeobject.c, PyType_GenericAlloc: + Allocated enough bytes to align the __dict__ pointer. + Sped and simplified the round-up-to-PTRSIZE logic. + Added blank lines so I could parse the if/else blocks <0.7 wink>.
2001-10-02Add Garbage Collection support to new-style classes (not yet to theirGuido van Rossum-3/+8
instances). Also added GC support to various auxiliary types: super, property, descriptors, wrappers, dictproxy. (Only type objects have a tp_clear field; the other types are.) One change was necessary to the GC infrastructure. We have statically allocated type objects that don't have a GC header (and can't easily be given one) and heap-allocated type objects that do have a GC header. Giving these different metatypes would be really ugly: I tried, and I had to modify pickle.py, cPickle.c, copy.py, add a new invent a new name for the new metatype and make it a built-in, change affected tests... In short, a mess. So instead, we add a new type slot tp_is_gc, which is a simple Boolean function that determines whether a particular instance has GC headers or not. This slot is only relevant for types that have the (new) GC flag bit set. If the tp_is_gc slot is NULL (by far the most common case), all instances of the type are deemed to have GC headers. This slot is called by the PyObject_IS_GC() macro (which is only used twice, both times in gcmodule.c). I also changed the extern declarations for a bunch of GC-related functions (_PyObject_GC_Del etc.): these always exist but objimpl.h only declared them when WITH_CYCLE_GC was defined, but I needed to be able to reference them without #ifdefs. (When WITH_CYCLE_GC is not defined, they do the same as their non-GC counterparts anyway.)
2001-09-03Fix the names of _PyObject_GC_TRACK and _PyObject_GC_UNTRACK when the GC isNeil Schemenauer-2/+2
disabled. Obviously everyone enables the GC. :-)
2001-08-29Change the GC type flag since the API has changed. Allow types usingNeil Schemenauer-46/+62
the old flag to still compile. Remove the PyType_BASICSIZE and PyType_SET_BASICSIZE macros. Add PyObject_GC_New, PyObject_GC_NewVar, PyObject_GC_Resize, PyObject_GC_Del, PyObject_GC_Track, PyObject_GC_UnTrack. Part of SF patch #421893.
2001-08-03Removed duplicate definnitions of PyObject_AS_GC and PyObject_FROM_GC ↵Jack Jansen-2/+0
(occurred only if GC was off).
2001-08-02Merge of descr-branch back into trunk.Tim Peters-1/+14
2001-03-22A small change to the C API for weakly-referencable types: Such typesFred Drake-5/+1
must now initialize the extra field used by the weak-ref machinery to NULL themselves, to avoid having to require PyObject_INIT() to check if the type supports weak references and do it there. This causes less work to be done for all objects (the type object does not need to be consulted to check for the Py_TPFLAGS_HAVE_WEAKREFS bit).
2001-02-27Add Vladimir Marangozov's object allocator. It is disabled by default. ThisNeil Schemenauer-0/+7
closes SF patch #401229.
2001-02-02Use a type flag to determine the applicability of the tp_weaklistoffsetFred Drake-1/+3
field. This should avoid binary incompatibility problems with older modules that have not been recompiled.
2001-02-01PEP 205, Weak References -- initial checkin.Fred Drake-1/+11
2001-01-24PyGC_Dump() -> _PyGC_Dump()Barry Warsaw-1/+1
2001-01-23Add prototype for PyGC_Dump() -- but only inside the #ifdefBarry Warsaw-0/+2
WITH_CYCLE_GC.
2001-01-20Fix comment.Neil Schemenauer-2/+2
2000-09-01REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum-9/+0
This should match the situation in the 1.6b1 tree.
2000-08-16Updated commentAndrew M. Kuchling-1/+1