Skip to main content

Objects/

The catalogue of built-in types and the protocol dispatch layer. Each type has a file: int is longobject.c, str is unicodeobject.c, dict is dictobject.c, etc. The spine is object.c, typeobject.c, abstract.c.

File inventory

FileLinesPageType
Objects/abstract.c2947abstractspine
Objects/boolobject.c227boolobjectbool
Objects/bytearrayobject.c3070bytearrayobjectbytearray
Objects/bytes_methods.c740(pending)bytes/str helpers
Objects/bytesobject.c3736(pending)bytes
Objects/call.c1130(pending)call protocol
Objects/capsule.c366(pending)capsule
Objects/cellobject.c212(pending)cell
Objects/classobject.c518(pending)bound method
Objects/codeobject.c3666codeobjectcode
Objects/complexobject.c1422complexobjectcomplex
Objects/descrobject.c2082(pending)spine
Objects/dictobject.c7824dictobjectdict
Objects/enumobject.c585(pending)enumerate
Objects/exceptions.c4586exceptionsexceptions
Objects/fileobject.c548(pending)file
Objects/floatobject.c2642(pending)float
Objects/frameobject.c2446(pending)frame
Objects/funcobject.c1907(pending)function
Objects/genericaliasobject.c1053(pending)list[int] etc.
Objects/genobject.c2419genobjectgenerator/coro
Objects/interpolationobject.c231(pending)interpolation
Objects/iterobject.c541(pending)zip/map/filter
Objects/listobject.c4262listobjectlist
Objects/longobject.c6871longobjectint
Objects/memoryobject.c3612(pending)memoryview
Objects/methodobject.c578(pending)method
Objects/moduleobject.c1440(pending)module
Objects/namespaceobject.c332(pending)SimpleNamespace
Objects/object.c3395objectspine
Objects/obmalloc.c3662(pending)allocator
Objects/odictobject.c2371(pending)OrderedDict
Objects/picklebufobject.c224(pending)PickleBuffer
Objects/rangeobject.c1317rangeobjectrange
Objects/setobject.c2886(pending)set
Objects/sliceobject.c708(pending)slice
Objects/structseq.c795(pending)structseq
Objects/templateobject.c412(pending)template
Objects/tupleobject.c1214(pending)tuple
Objects/typeobject.c12302typeobjectspine
Objects/typevarobject.c2388(pending)TypeVar etc.
Objects/unicodectype.c287(pending)str helpers
Objects/unicodeobject.c16798unicodeobjectstr
Objects/unionobject.c599(pending)int
Objects/weakrefobject.c1134(pending)weakref

Total: 46 files, ~120k lines. unicodeobject.c alone is 16k lines (PEP 393 kind machinery + all string methods); typeobject.c is 12k (the metaclass + slot inheritance + PyType_Ready); dictobject.c is 8k (combined + split layouts, the watcher hooks).

Reading order

  1. object.c: the generic operations and refcount macros.
  2. typeobject.c: the metaclass, slot inheritance, PyType_Ready.
  3. abstract.c: the protocol dispatch layer.
  4. Then the per-type files in any order.