summaryrefslogtreecommitdiff
path: root/Include/objimpl.h
AgeCommit message (Collapse)AuthorLines
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
2000-07-31patch from Vladimir (move Py_Mem* interface to Include/pymem.h)Peter Schneider-Kamp-2/+3
2000-07-31merge Include/my*.h into Include/pyport.hPeter Schneider-Kamp-1/+1
marked my*.h as obsolete
2000-07-25Use 'void' directly instead of the ANY #define, now that all code is ANSI C.Thomas Wouters-7/+7
Leave the actual #define in for API compatibility.
2000-07-10A small comment fix just to make sure I got my cvs/ssh setup right.Vladimir Marangozov-1/+1
2000-07-09ANSI-fication and Py_PROTO extermination.Fred Drake-16/+17
2000-07-01Neil Schemenauer: small fixes for GCGuido van Rossum-6/+3
2000-06-30Change copyright notice - 2nd try.Guido van Rossum-6/+0
2000-06-30Change copyright notice.Guido van Rossum-21/+6
2000-06-30final patches from Neil Schemenauer for garbage collectionJeremy Hylton-3/+58
2000-06-23part 2 of Neil Schemenauer's GC patches:Jeremy Hylton-0/+6
This patch modifies the type structures of objects that participate in GC. The object's tp_basicsize is increased when GC is enabled. GC information is prefixed to the object to maintain binary compatibility. GC objects also define the tp_flag Py_TPFLAGS_GC.
2000-05-03Vladimir Marangozov's long-awaited malloc restructuring.Guido van Rossum-25/+187
For more comments, read the patches@python.org archives. For documentation read the comments in mymalloc.h and objimpl.h. (This is not exactly what Vladimir posted to the patches list; I've made a few changes, and Vladimir sent me a fix in private email for a problem that only occurs in debug mode. I'm also holding back on his change to main.c, which seems unnecessary to me.)
2000-03-01Got rid of silly "123456789-..." lines in comments.Guido van Rossum-2/+0
1998-12-04Add DL_IMPORT(returntype) for all officially exported functions.Guido van Rossum-4/+4
1997-05-15Oops, another forgotten renaming: varobject -> PyVarObject.Guido van Rossum-3/+3
1996-10-25New permission notice, includes CNRI.Guido van Rossum-12/+19
1996-07-21Hacks for MS_COREDLLGuido van Rossum-0/+14
1995-02-10make newvarobj's size arg signedGuido van Rossum-1/+1
1995-01-12The great renaming, phase two: all header files have been updated toGuido van Rossum-7/+7
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".
1995-01-04Added 1995 copyright.Guido van Rossum-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.
1994-08-01Merge alpha100 branch back to main trunkGuido van Rossum-1/+1
1993-07-28* Added support for X11 modules.Guido van Rossum-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++.
1993-03-29* Changed all copyright messages to include 1993.Guido van Rossum-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
1992-04-05Copyright for 1992 addedGuido van Rossum-1/+1
1991-06-07Remove StopPrint hackGuido van Rossum-2/+0
1991-02-19Added copyright notice.Guido van Rossum-0/+24
1990-12-20"Compiling" versionGuido van Rossum-5/+0
1990-10-21Changed strdup prototype to use const.Guido van Rossum-1/+1
1990-10-14Initial revisionGuido van Rossum-0/+31