mirror of
https://github.com/python/cpython
synced 2026-09-29 00:10:31 +03:00
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.) |
||
|---|---|---|
| .. | ||
| abstract.h | ||
| bitset.h | ||
| bufferobject.h | ||
| cellobject.h | ||
| ceval.h | ||
| classobject.h | ||
| cobject.h | ||
| codecs.h | ||
| compile.h | ||
| complexobject.h | ||
| cStringIO.h | ||
| descrobject.h | ||
| dictobject.h | ||
| errcode.h | ||
| eval.h | ||
| fileobject.h | ||
| floatobject.h | ||
| frameobject.h | ||
| funcobject.h | ||
| graminit.h | ||
| grammar.h | ||
| import.h | ||
| intobject.h | ||
| intrcheck.h | ||
| iterobject.h | ||
| listobject.h | ||
| longintrepr.h | ||
| longobject.h | ||
| marshal.h | ||
| metagrammar.h | ||
| methodobject.h | ||
| modsupport.h | ||
| moduleobject.h | ||
| node.h | ||
| object.h | ||
| objimpl.h | ||
| opcode.h | ||
| osdefs.h | ||
| parsetok.h | ||
| patchlevel.h | ||
| pgenheaders.h | ||
| py_curses.h | ||
| pydebug.h | ||
| pyerrors.h | ||
| pyfpe.h | ||
| pygetopt.h | ||
| pymactoolbox.h | ||
| pymem.h | ||
| pyport.h | ||
| pystate.h | ||
| Python.h | ||
| pythonrun.h | ||
| pythread.h | ||
| rangeobject.h | ||
| sliceobject.h | ||
| stringobject.h | ||
| structmember.h | ||
| symtable.h | ||
| sysmodule.h | ||
| token.h | ||
| traceback.h | ||
| tupleobject.h | ||
| ucnhash.h | ||
| unicodeobject.h | ||