| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  | typedef struct _typeobject { | 
					
						
							|  |  |  |     PyObject_VAR_HEAD | 
					
						
							| 
									
										
										
										
											2015-08-25 05:06:39 +00:00
										 |  |  |     const char *tp_name; /* For printing, in format "<module>.<name>" */ | 
					
						
							|  |  |  |     Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */ | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /* Methods to implement standard operations */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     destructor tp_dealloc; | 
					
						
							| 
									
										
										
										
											2019-06-03 01:43:13 +02:00
										 |  |  |     Py_ssize_t tp_vectorcall_offset; | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  |     getattrfunc tp_getattr; | 
					
						
							|  |  |  |     setattrfunc tp_setattr; | 
					
						
							| 
									
										
										
										
											2015-08-26 13:03:57 -04:00
										 |  |  |     PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2)
 | 
					
						
							|  |  |  |                                     or tp_reserved (Python 3) */ | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  |     reprfunc tp_repr; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* Method suites for standard classes */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     PyNumberMethods *tp_as_number; | 
					
						
							|  |  |  |     PySequenceMethods *tp_as_sequence; | 
					
						
							|  |  |  |     PyMappingMethods *tp_as_mapping; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* More standard operations (here for binary compatibility) */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     hashfunc tp_hash; | 
					
						
							|  |  |  |     ternaryfunc tp_call; | 
					
						
							|  |  |  |     reprfunc tp_str; | 
					
						
							|  |  |  |     getattrofunc tp_getattro; | 
					
						
							|  |  |  |     setattrofunc tp_setattro; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* Functions to access object as input/output buffer */ | 
					
						
							|  |  |  |     PyBufferProcs *tp_as_buffer; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* Flags to define presence of optional/expanded features */ | 
					
						
							| 
									
										
										
										
											2015-08-25 05:06:39 +00:00
										 |  |  |     unsigned long tp_flags; | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-25 05:06:39 +00:00
										 |  |  |     const char *tp_doc; /* Documentation string */ | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-29 10:26:34 +02:00
										 |  |  |     /* Assigned meaning in release 2.0 */ | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  |     /* call function for all accessible objects */ | 
					
						
							|  |  |  |     traverseproc tp_traverse; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* delete references to contained objects */ | 
					
						
							|  |  |  |     inquiry tp_clear; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-29 10:26:34 +02:00
										 |  |  |     /* Assigned meaning in release 2.1 */ | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  |     /* rich comparisons */ | 
					
						
							|  |  |  |     richcmpfunc tp_richcompare; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* weak reference enabler */ | 
					
						
							| 
									
										
										
										
											2015-08-25 05:06:39 +00:00
										 |  |  |     Py_ssize_t tp_weaklistoffset; | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /* Iterators */ | 
					
						
							|  |  |  |     getiterfunc tp_iter; | 
					
						
							|  |  |  |     iternextfunc tp_iternext; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* Attribute descriptor and subclassing stuff */ | 
					
						
							| 
									
										
										
										
											2025-04-10 01:51:56 +01:00
										 |  |  |     PyMethodDef *tp_methods; | 
					
						
							|  |  |  |     PyMemberDef *tp_members; | 
					
						
							|  |  |  |     PyGetSetDef *tp_getset; | 
					
						
							| 
									
										
										
										
											2021-04-29 10:26:34 +02:00
										 |  |  |     // Strong reference on a heap type, borrowed reference on a static type
 | 
					
						
							| 
									
										
										
										
											2025-04-10 01:51:56 +01:00
										 |  |  |     PyTypeObject *tp_base; | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  |     PyObject *tp_dict; | 
					
						
							|  |  |  |     descrgetfunc tp_descr_get; | 
					
						
							|  |  |  |     descrsetfunc tp_descr_set; | 
					
						
							| 
									
										
										
										
											2015-08-25 05:06:39 +00:00
										 |  |  |     Py_ssize_t tp_dictoffset; | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  |     initproc tp_init; | 
					
						
							|  |  |  |     allocfunc tp_alloc; | 
					
						
							|  |  |  |     newfunc tp_new; | 
					
						
							|  |  |  |     freefunc tp_free; /* Low-level free-memory routine */ | 
					
						
							|  |  |  |     inquiry tp_is_gc; /* For PyObject_IS_GC */ | 
					
						
							|  |  |  |     PyObject *tp_bases; | 
					
						
							|  |  |  |     PyObject *tp_mro; /* method resolution order */ | 
					
						
							| 
									
										
										
										
											2025-04-10 01:51:56 +01:00
										 |  |  |     PyObject *tp_cache; /* no longer used */ | 
					
						
							|  |  |  |     void *tp_subclasses;  /* for static builtin types this is an index */ | 
					
						
							|  |  |  |     PyObject *tp_weaklist; /* not used for static builtin types */ | 
					
						
							| 
									
										
										
										
											2013-07-30 19:59:21 +02:00
										 |  |  |     destructor tp_del; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-10 01:51:56 +01:00
										 |  |  |     /* Type attribute cache version tag. Added in version 2.6.
 | 
					
						
							|  |  |  |      * If zero, the cache is invalid and must be initialized. | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2013-07-30 19:59:21 +02:00
										 |  |  |     unsigned int tp_version_tag; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     destructor tp_finalize; | 
					
						
							| 
									
										
										
										
											2021-04-29 10:26:34 +02:00
										 |  |  |     vectorcallfunc tp_vectorcall; | 
					
						
							| 
									
										
										
										
											2022-12-15 04:26:08 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /* bitset of which type-watchers care about this type */ | 
					
						
							| 
									
										
										
										
											2023-08-11 12:42:26 -06:00
										 |  |  |     unsigned char tp_watched; | 
					
						
							| 
									
										
										
										
											2025-04-10 01:51:56 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /* Number of tp_version_tag values used.
 | 
					
						
							|  |  |  |      * Set to _Py_ATTR_CACHE_UNUSED if the attribute cache is | 
					
						
							|  |  |  |      * disabled for this type (e.g. due to custom MRO entries). | 
					
						
							|  |  |  |      * Otherwise, limited to MAX_VERSIONS_PER_CLASS (defined elsewhere). | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     uint16_t tp_versions_used; | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  | } PyTypeObject; |