#include "Python.h"
#include "pycore_abstract.h"
#include "pycore_call.h"
#include "pycore_code.h"
#include "pycore_dict.h"
#include "pycore_frame.h"
#include "pycore_lock.h"
#include "pycore_long.h"
#include "pycore_memoryobject.h"
#include "pycore_modsupport.h"
#include "pycore_moduleobject.h"
#include "pycore_object.h"
#include "pycore_object_alloc.h"
#include "pycore_pyerrors.h"
#include "pycore_pystate.h"
#include "pycore_symtable.h"
#include "pycore_typeobject.h"
#include "pycore_unionobject.h"
#include "pycore_weakref.h"
#include "opcode.h"
#include <stddef.h>
#include "clinic/typeobject.c.h"
#define MCACHE_MAX_ATTR_SIZE …
#define MCACHE_HASH(version, name_hash) …
#define MCACHE_HASH_METHOD(type, name) …
#define MCACHE_CACHEABLE_NAME(name) …
#define NEXT_GLOBAL_VERSION_TAG …
#define NEXT_VERSION_TAG(interp) …
#ifdef Py_GIL_DISABLED
#define TYPE_LOCK …
#define BEGIN_TYPE_LOCK …
#define END_TYPE_LOCK …
#define BEGIN_TYPE_DICT_LOCK …
#define END_TYPE_DICT_LOCK …
#define ASSERT_TYPE_LOCK_HELD …
#else
#define BEGIN_TYPE_LOCK() …
#define END_TYPE_LOCK() …
#define BEGIN_TYPE_DICT_LOCK(d) …
#define END_TYPE_DICT_LOCK() …
#define ASSERT_TYPE_LOCK_HELD() …
#endif
PySlot_Offset;
static void
slot_bf_releasebuffer(PyObject *self, Py_buffer *buffer);
static void
releasebuffer_call_python(PyObject *self, Py_buffer *buffer);
static PyObject *
slot_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
static PyObject *
lookup_maybe_method(PyObject *self, PyObject *attr, int *unbound);
static int
slot_tp_setattro(PyObject *self, PyObject *name, PyObject *value);
static inline PyTypeObject *
type_from_ref(PyObject *ref)
{ … }
#ifndef NDEBUG
static inline int
managed_static_type_index_is_set(PyTypeObject *self)
{
return self->tp_subclasses != NULL;
}
#endif
static inline size_t
managed_static_type_index_get(PyTypeObject *self)
{ … }
static inline void
managed_static_type_index_set(PyTypeObject *self, size_t index)
{ … }
static inline void
managed_static_type_index_clear(PyTypeObject *self)
{ … }
static PyTypeObject *
static_ext_type_lookup(PyInterpreterState *interp, size_t index,
int64_t *p_interp_count)
{ … }
static managed_static_type_state *
managed_static_type_state_get(PyInterpreterState *interp, PyTypeObject *self)
{ … }
managed_static_type_state *
_PyStaticType_GetState(PyInterpreterState *interp, PyTypeObject *self)
{ … }
static void
managed_static_type_state_init(PyInterpreterState *interp, PyTypeObject *self,
int isbuiltin, int initial)
{ … }
static void
managed_static_type_state_clear(PyInterpreterState *interp, PyTypeObject *self,
int isbuiltin, int final)
{ … }
PyObject *
_PyStaticType_GetBuiltins(void)
{ … }
static inline void
start_readying(PyTypeObject *type)
{ … }
static inline void
stop_readying(PyTypeObject *type)
{ … }
static inline int
is_readying(PyTypeObject *type)
{ … }
static inline PyObject *
lookup_tp_dict(PyTypeObject *self)
{ … }
PyObject *
_PyType_GetDict(PyTypeObject *self)
{ … }
PyObject *
PyType_GetDict(PyTypeObject *self)
{ … }
static inline void
set_tp_dict(PyTypeObject *self, PyObject *dict)
{ … }
static inline void
clear_tp_dict(PyTypeObject *self)
{ … }
static inline PyObject *
lookup_tp_bases(PyTypeObject *self)
{ … }
PyObject *
_PyType_GetBases(PyTypeObject *self)
{ … }
static inline void
set_tp_bases(PyTypeObject *self, PyObject *bases, int initial)
{ … }
static inline void
clear_tp_bases(PyTypeObject *self, int final)
{ … }
static inline PyObject *
lookup_tp_mro(PyTypeObject *self)
{ … }
PyObject *
_PyType_GetMRO(PyTypeObject *self)
{ … }
static inline void
set_tp_mro(PyTypeObject *self, PyObject *mro, int initial)
{ … }
static inline void
clear_tp_mro(PyTypeObject *self, int final)
{ … }
static PyObject *
init_tp_subclasses(PyTypeObject *self)
{ … }
static void
clear_tp_subclasses(PyTypeObject *self)
{ … }
static inline PyObject *
lookup_tp_subclasses(PyTypeObject *self)
{ … }
int
_PyType_HasSubclasses(PyTypeObject *self)
{ … }
PyObject*
_PyType_GetSubclasses(PyTypeObject *self)
{ … }
static const char *
find_signature(const char *name, const char *doc)
{ … }
#define SIGNATURE_END_MARKER …
#define SIGNATURE_END_MARKER_LENGTH …
static const char *
skip_signature(const char *doc)
{ … }
int
_PyType_CheckConsistency(PyTypeObject *type)
{ … }
static const char *
_PyType_DocWithoutSignature(const char *name, const char *internal_doc)
{ … }
PyObject *
_PyType_GetDocFromInternalDoc(const char *name, const char *internal_doc)
{ … }
static const char *
signature_from_flags(int flags)
{ … }
PyObject *
_PyType_GetTextSignatureFromInternalDoc(const char *name, const char *internal_doc, int flags)
{ … }
static struct type_cache*
get_type_cache(void)
{ … }
static void
type_cache_clear(struct type_cache *cache, PyObject *value)
{ … }
void
_PyType_InitCache(PyInterpreterState *interp)
{ … }
static unsigned int
_PyType_ClearCache(PyInterpreterState *interp)
{ … }
unsigned int
PyType_ClearCache(void)
{ … }
void
_PyTypes_Fini(PyInterpreterState *interp)
{ … }
int
PyType_AddWatcher(PyType_WatchCallback callback)
{ … }
static inline int
validate_watcher_id(PyInterpreterState *interp, int watcher_id)
{ … }
int
PyType_ClearWatcher(int watcher_id)
{ … }
static int assign_version_tag(PyInterpreterState *interp, PyTypeObject *type);
int
PyType_Watch(int watcher_id, PyObject* obj)
{ … }
int
PyType_Unwatch(int watcher_id, PyObject* obj)
{ … }
static void
set_version_unlocked(PyTypeObject *tp, unsigned int version)
{ … }
static void
type_modified_unlocked(PyTypeObject *type)
{ … }
void
PyType_Modified(PyTypeObject *type)
{ … }
static int
is_subtype_with_mro(PyObject *a_mro, PyTypeObject *a, PyTypeObject *b);
static void
type_mro_modified(PyTypeObject *type, PyObject *bases) { … }
void
_PyType_SetVersion(PyTypeObject *tp, unsigned int version)
{ … }
PyTypeObject *
_PyType_LookupByVersion(unsigned int version)
{ … }
unsigned int
_PyType_GetVersionForCurrentState(PyTypeObject *tp)
{ … }
#define MAX_VERSIONS_PER_CLASS …
static int
assign_version_tag(PyInterpreterState *interp, PyTypeObject *type)
{ … }
int PyUnstable_Type_AssignVersionTag(PyTypeObject *type)
{ … }
static PyMemberDef type_members[] = …;
static int
check_set_special_type_attr(PyTypeObject *type, PyObject *value, const char *name)
{ … }
const char *
_PyType_Name(PyTypeObject *type)
{ … }
static PyObject *
type_name(PyTypeObject *type, void *context)
{ … }
static PyObject *
type_qualname(PyTypeObject *type, void *context)
{ … }
static int
type_set_name(PyTypeObject *type, PyObject *value, void *context)
{ … }
static int
type_set_qualname(PyTypeObject *type, PyObject *value, void *context)
{ … }
static PyObject *
type_module(PyTypeObject *type)
{ … }
static PyObject *
type_get_module(PyTypeObject *type, void *context)
{ … }
static int
type_set_module(PyTypeObject *type, PyObject *value, void *context)
{ … }
PyObject *
_PyType_GetFullyQualifiedName(PyTypeObject *type, char sep)
{ … }
PyObject *
PyType_GetFullyQualifiedName(PyTypeObject *type)
{ … }
static PyObject *
type_abstractmethods(PyTypeObject *type, void *context)
{ … }
static int
type_set_abstractmethods(PyTypeObject *type, PyObject *value, void *context)
{ … }
static PyObject *
type_get_bases(PyTypeObject *type, void *context)
{ … }
static PyObject *
type_get_mro(PyTypeObject *type, void *context)
{ … }
static PyTypeObject *best_base(PyObject *);
static int mro_internal(PyTypeObject *, PyObject **);
static int type_is_subtype_base_chain(PyTypeObject *, PyTypeObject *);
static int compatible_for_assignment(PyTypeObject *, PyTypeObject *, const char *);
static int add_subclass(PyTypeObject*, PyTypeObject*);
static int add_all_subclasses(PyTypeObject *type, PyObject *bases);
static void remove_subclass(PyTypeObject *, PyTypeObject *);
static void remove_all_subclasses(PyTypeObject *type, PyObject *bases);
static void update_all_slots(PyTypeObject *);
update_callback;
static int update_subclasses(PyTypeObject *type, PyObject *attr_name,
update_callback callback, void *data);
static int recurse_down_subclasses(PyTypeObject *type, PyObject *name,
update_callback callback, void *data);
static int
mro_hierarchy(PyTypeObject *type, PyObject *temp)
{ … }
static int
type_set_bases_unlocked(PyTypeObject *type, PyObject *new_bases, void *context)
{ … }
static int
type_set_bases(PyTypeObject *type, PyObject *new_bases, void *context)
{ … }
static PyObject *
type_dict(PyTypeObject *type, void *context)
{ … }
static PyObject *
type_get_doc(PyTypeObject *type, void *context)
{ … }
static PyObject *
type_get_text_signature(PyTypeObject *type, void *context)
{ … }
static int
type_set_doc(PyTypeObject *type, PyObject *value, void *context)
{ … }
static PyObject *
type_get_annotate(PyTypeObject *type, void *Py_UNUSED(ignored))
{ … }
static int
type_set_annotate(PyTypeObject *type, PyObject *value, void *Py_UNUSED(ignored))
{ … }
static PyObject *
type_get_annotations(PyTypeObject *type, void *context)
{ … }
static int
type_set_annotations(PyTypeObject *type, PyObject *value, void *context)
{ … }
static PyObject *
type_get_type_params(PyTypeObject *type, void *context)
{ … }
static int
type_set_type_params(PyTypeObject *type, PyObject *value, void *context)
{ … }
static int
type___instancecheck___impl(PyTypeObject *self, PyObject *instance)
{ … }
static int
type___subclasscheck___impl(PyTypeObject *self, PyObject *subclass)
{ … }
static PyGetSetDef type_getsets[] = …;
static PyObject *
type_repr(PyObject *self)
{ … }
static PyObject *
type_call(PyObject *self, PyObject *args, PyObject *kwds)
{ … }
PyObject *
_PyType_NewManagedObject(PyTypeObject *type)
{ … }
PyObject *
_PyType_AllocNoTrack(PyTypeObject *type, Py_ssize_t nitems)
{ … }
PyObject *
PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)
{ … }
PyObject *
PyType_GenericNew(PyTypeObject *type, PyObject *args, PyObject *kwds)
{ … }
static inline PyMemberDef *
_PyHeapType_GET_MEMBERS(PyHeapTypeObject* type)
{ … }
static int
traverse_slots(PyTypeObject *type, PyObject *self, visitproc visit, void *arg)
{ … }
static int
subtype_traverse(PyObject *self, visitproc visit, void *arg)
{ … }
static void
clear_slots(PyTypeObject *type, PyObject *self)
{ … }
static int
subtype_clear(PyObject *self)
{ … }
static void
subtype_dealloc(PyObject *self)
{ … }
static PyTypeObject *solid_base(PyTypeObject *type);
static int
type_is_subtype_base_chain(PyTypeObject *a, PyTypeObject *b)
{ … }
static int
is_subtype_with_mro(PyObject *a_mro, PyTypeObject *a, PyTypeObject *b)
{ … }
int
PyType_IsSubtype(PyTypeObject *a, PyTypeObject *b)
{ … }
PyObject *
_PyObject_LookupSpecial(PyObject *self, PyObject *attr)
{ … }
PyObject *
_PyObject_LookupSpecialMethod(PyObject *self, PyObject *attr, PyObject **self_or_null)
{ … }
static PyObject *
lookup_maybe_method(PyObject *self, PyObject *attr, int *unbound)
{ … }
static PyObject *
lookup_method(PyObject *self, PyObject *attr, int *unbound)
{ … }
static inline PyObject*
vectorcall_unbound(PyThreadState *tstate, int unbound, PyObject *func,
PyObject *const *args, Py_ssize_t nargs)
{ … }
static PyObject*
call_unbound_noarg(int unbound, PyObject *func, PyObject *self)
{ … }
static PyObject *
vectorcall_method(PyObject *name, PyObject *const *args, Py_ssize_t nargs)
{ … }
static PyObject *
vectorcall_maybe(PyThreadState *tstate, PyObject *name,
PyObject *const *args, Py_ssize_t nargs)
{ … }
static int
tail_contains(PyObject *tuple, int whence, PyObject *o)
{ … }
static PyObject *
class_name(PyObject *cls)
{ … }
static int
check_duplicates(PyObject *tuple)
{ … }
static void
set_mro_error(PyObject **to_merge, Py_ssize_t to_merge_size, int *remain)
{ … }
static int
pmerge(PyObject *acc, PyObject **to_merge, Py_ssize_t to_merge_size)
{ … }
static PyObject *
mro_implementation_unlocked(PyTypeObject *type)
{ … }
static PyObject *
mro_implementation(PyTypeObject *type)
{ … }
static PyObject *
type_mro_impl(PyTypeObject *self)
{ … }
static int
mro_check(PyTypeObject *type, PyObject *mro)
{ … }
static PyObject *
mro_invoke(PyTypeObject *type)
{ … }
static int
mro_internal_unlocked(PyTypeObject *type, int initial, PyObject **p_old_mro)
{ … }
static int
mro_internal(PyTypeObject *type, PyObject **p_old_mro)
{ … }
static PyTypeObject *
best_base(PyObject *bases)
{ … }
static int
shape_differs(PyTypeObject *t1, PyTypeObject *t2)
{ … }
static PyTypeObject *
solid_base(PyTypeObject *type)
{ … }
static void object_dealloc(PyObject *);
static PyObject *object_new(PyTypeObject *, PyObject *, PyObject *);
static int object_init(PyObject *, PyObject *, PyObject *);
static int update_slot(PyTypeObject *, PyObject *);
static void fixup_slot_dispatchers(PyTypeObject *);
static int type_new_set_names(PyTypeObject *);
static int type_new_init_subclass(PyTypeObject *, PyObject *);
static PyTypeObject *
get_builtin_base_with_dict(PyTypeObject *type)
{ … }
static PyObject *
get_dict_descriptor(PyTypeObject *type)
{ … }
static void
raise_dict_descr_error(PyObject *obj)
{ … }
static PyObject *
subtype_dict(PyObject *obj, void *context)
{ … }
static int
subtype_setdict(PyObject *obj, PyObject *value, void *context)
{ … }
static PyObject *
subtype_getweakref(PyObject *obj, void *context)
{ … }
static PyGetSetDef subtype_getsets_full[] = …;
static PyGetSetDef subtype_getsets_dict_only[] = …;
static PyGetSetDef subtype_getsets_weakref_only[] = …;
static int
valid_identifier(PyObject *s)
{ … }
static int
type_init(PyObject *cls, PyObject *args, PyObject *kwds)
{ … }
unsigned long
PyType_GetFlags(PyTypeObject *type)
{ … }
int
PyType_SUPPORTS_WEAKREFS(PyTypeObject *type)
{ … }
PyTypeObject *
_PyType_CalculateMetaclass(PyTypeObject *metatype, PyObject *bases)
{ … }
static PyObject *
type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds);
type_new_ctx;
static int
type_new_visit_slots(type_new_ctx *ctx)
{ … }
static PyObject*
type_new_copy_slots(type_new_ctx *ctx, PyObject *dict)
{ … }
static void
type_new_slots_bases(type_new_ctx *ctx)
{ … }
static int
type_new_slots_impl(type_new_ctx *ctx, PyObject *dict)
{ … }
static Py_ssize_t
type_new_slots(type_new_ctx *ctx, PyObject *dict)
{ … }
static PyTypeObject*
type_new_alloc(type_new_ctx *ctx)
{ … }
static int
type_new_set_name(const type_new_ctx *ctx, PyTypeObject *type)
{ … }
static int
type_new_set_module(PyTypeObject *type)
{ … }
static int
type_new_set_ht_name(PyTypeObject *type)
{ … }
static int
type_new_set_doc(PyTypeObject *type)
{ … }
static int
type_new_staticmethod(PyTypeObject *type, PyObject *attr)
{ … }
static int
type_new_classmethod(PyTypeObject *type, PyObject *attr)
{ … }
static int
type_new_descriptors(const type_new_ctx *ctx, PyTypeObject *type)
{ … }
static void
type_new_set_slots(const type_new_ctx *ctx, PyTypeObject *type)
{ … }
static int
type_new_set_classcell(PyTypeObject *type)
{ … }
static int
type_new_set_classdictcell(PyTypeObject *type)
{ … }
static int
type_new_set_attrs(const type_new_ctx *ctx, PyTypeObject *type)
{ … }
static int
type_new_get_slots(type_new_ctx *ctx, PyObject *dict)
{ … }
static PyTypeObject*
type_new_init(type_new_ctx *ctx)
{ … }
static PyObject*
type_new_impl(type_new_ctx *ctx)
{ … }
static int
type_new_get_bases(type_new_ctx *ctx, PyObject **type)
{ … }
static PyObject *
type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
type_vectorcall(PyObject *metatype, PyObject *const *args,
size_t nargsf, PyObject *kwnames)
{ … }
static const PySlot_Offset pyslot_offsets[] = …;
static Py_ssize_t
_align_up(Py_ssize_t size)
{ … }
inline static PyObject *
get_bases_tuple(PyObject *bases_in, PyType_Spec *spec)
{ … }
static inline int
check_basicsize_includes_size_and_offsets(PyTypeObject* type)
{ … }
static int
check_immutable_bases(const char *type_name, PyObject *bases, int skip_first)
{ … }
static inline int
special_offset_from_member(
const PyMemberDef *memb ,
Py_ssize_t type_data_offset,
Py_ssize_t *dest )
{ … }
PyObject *
PyType_FromMetaclass(
PyTypeObject *metaclass, PyObject *module,
PyType_Spec *spec, PyObject *bases_in)
{ … }
PyObject *
PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases)
{ … }
PyObject *
PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
{ … }
PyObject *
PyType_FromSpec(PyType_Spec *spec)
{ … }
PyObject *
PyType_GetName(PyTypeObject *type)
{ … }
PyObject *
PyType_GetQualName(PyTypeObject *type)
{ … }
PyObject *
PyType_GetModuleName(PyTypeObject *type)
{ … }
void *
PyType_GetSlot(PyTypeObject *type, int slot)
{ … }
PyObject *
PyType_GetModule(PyTypeObject *type)
{ … }
void *
PyType_GetModuleState(PyTypeObject *type)
{ … }
PyObject *
PyType_GetModuleByDef(PyTypeObject *type, PyModuleDef *def)
{ … }
static PyTypeObject *
get_base_by_token_recursive(PyObject *bases, void *token)
{ … }
int
PyType_GetBaseByToken(PyTypeObject *type, void *token, PyTypeObject **result)
{ … }
void *
PyObject_GetTypeData(PyObject *obj, PyTypeObject *cls)
{ … }
Py_ssize_t
PyType_GetTypeDataSize(PyTypeObject *cls)
{ … }
void *
PyObject_GetItemData(PyObject *obj)
{ … }
static PyObject *
find_name_in_mro(PyTypeObject *type, PyObject *name, int *error)
{ … }
static int
is_dunder_name(PyObject *name)
{ … }
static PyObject *
update_cache(struct type_cache_entry *entry, PyObject *name, unsigned int version_tag, PyObject *value)
{ … }
#if Py_GIL_DISABLED
static void
update_cache_gil_disabled(struct type_cache_entry *entry, PyObject *name,
unsigned int version_tag, PyObject *value)
{
_PySeqLock_LockWrite(&entry->sequence);
if (entry->name == name &&
entry->value == value &&
entry->version == version_tag) {
_PySeqLock_AbandonWrite(&entry->sequence);
return;
}
PyObject *old_value = update_cache(entry, name, version_tag, value);
_PySeqLock_UnlockWrite(&entry->sequence);
Py_DECREF(old_value);
}
#endif
void
_PyTypes_AfterFork(void)
{ … }
PyObject *
_PyType_LookupRef(PyTypeObject *type, PyObject *name)
{ … }
PyObject *
_PyType_Lookup(PyTypeObject *type, PyObject *name)
{ … }
static void
set_flags(PyTypeObject *self, unsigned long mask, unsigned long flags)
{ … }
void
_PyType_SetFlags(PyTypeObject *self, unsigned long mask, unsigned long flags)
{ … }
int
_PyType_Validate(PyTypeObject *ty, _py_validate_type validate, unsigned int *tp_version)
{ … }
static void
set_flags_recursive(PyTypeObject *self, unsigned long mask, unsigned long flags)
{ … }
void
_PyType_SetFlagsRecursive(PyTypeObject *self, unsigned long mask, unsigned long flags)
{ … }
PyObject *
_Py_type_getattro_impl(PyTypeObject *type, PyObject *name, int * suppress_missing_attribute)
{ … }
PyObject *
_Py_type_getattro(PyObject *type, PyObject *name)
{ … }
static int
type_update_dict(PyTypeObject *type, PyDictObject *dict, PyObject *name,
PyObject *value, PyObject **old_value)
{ … }
static int
type_setattro(PyObject *self, PyObject *name, PyObject *value)
{ … }
static void
type_dealloc_common(PyTypeObject *type)
{ … }
static void
clear_static_tp_subclasses(PyTypeObject *type, int isbuiltin)
{ … }
static void
clear_static_type_objects(PyInterpreterState *interp, PyTypeObject *type,
int isbuiltin, int final)
{ … }
static void
fini_static_type(PyInterpreterState *interp, PyTypeObject *type,
int isbuiltin, int final)
{ … }
void
_PyTypes_FiniExtTypes(PyInterpreterState *interp)
{ … }
void
_PyStaticType_FiniBuiltin(PyInterpreterState *interp, PyTypeObject *type)
{ … }
static void
type_dealloc(PyObject *self)
{ … }
static PyObject *
type___subclasses___impl(PyTypeObject *self)
{ … }
static PyObject *
type_prepare(PyObject *self, PyObject *const *args, Py_ssize_t nargs,
PyObject *kwnames)
{ … }
static int
merge_class_dict(PyObject *dict, PyObject *aclass)
{ … }
static PyObject *
type___dir___impl(PyTypeObject *self)
{ … }
static PyObject *
type___sizeof___impl(PyTypeObject *self)
{ … }
static PyMethodDef type_methods[] = …;
PyDoc_STRVAR(type_doc,
"type(object) -> the object's type\n"
"type(name, bases, dict, **kwds) -> a new type");
static int
type_traverse(PyObject *self, visitproc visit, void *arg)
{ … }
static int
type_clear(PyObject *self)
{ … }
static int
type_is_gc(PyObject *type)
{ … }
static PyNumberMethods type_as_number = …;
PyTypeObject PyType_Type = …;
static PyObject *
object_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
static int
excess_args(PyObject *args, PyObject *kwds)
{ … }
static int
object_init(PyObject *self, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{ … }
static void
object_dealloc(PyObject *self)
{ … }
static PyObject *
object_repr(PyObject *self)
{ … }
static PyObject *
object_str(PyObject *self)
{ … }
static PyObject *
object_richcompare(PyObject *self, PyObject *other, int op)
{ … }
PyObject*
_Py_BaseObject_RichCompare(PyObject* self, PyObject* other, int op)
{ … }
static PyObject *
object_get_class(PyObject *self, void *closure)
{ … }
static int
compatible_with_tp_base(PyTypeObject *child)
{ … }
static int
same_slots_added(PyTypeObject *a, PyTypeObject *b)
{ … }
static int
compatible_for_assignment(PyTypeObject* oldto, PyTypeObject* newto, const char* attr)
{ … }
static int
object_set_class_world_stopped(PyObject *self, PyTypeObject *newto)
{ … }
static int
object_set_class(PyObject *self, PyObject *value, void *closure)
{ … }
static PyGetSetDef object_getsets[] = …;
static PyObject *
import_copyreg(void)
{ … }
static PyObject *
_PyType_GetSlotNames(PyTypeObject *cls)
{ … }
static PyObject *
object_getstate_default(PyObject *obj, int required)
{ … }
static PyObject *
object_getstate(PyObject *obj, int required)
{ … }
PyObject *
_PyObject_GetState(PyObject *obj)
{ … }
static PyObject *
object___getstate___impl(PyObject *self)
{ … }
static int
_PyObject_GetNewArguments(PyObject *obj, PyObject **args, PyObject **kwargs)
{ … }
static int
_PyObject_GetItemsIter(PyObject *obj, PyObject **listitems,
PyObject **dictitems)
{ … }
static PyObject *
reduce_newobj(PyObject *obj)
{ … }
static PyObject *
_common_reduce(PyObject *self, int proto)
{ … }
static PyObject *
object___reduce___impl(PyObject *self)
{ … }
static PyObject *
object___reduce_ex___impl(PyObject *self, int protocol)
{ … }
static PyObject *
object_subclasshook(PyObject *cls, PyObject *args)
{ … }
PyDoc_STRVAR(object_subclasshook_doc,
"Abstract classes can override this to customize issubclass().\n"
"\n"
"This is invoked early on by abc.ABCMeta.__subclasscheck__().\n"
"It should return True, False or NotImplemented. If it returns\n"
"NotImplemented, the normal algorithm is used. Otherwise, it\n"
"overrides the normal algorithm (and the outcome is cached).\n");
static PyObject *
object_init_subclass(PyObject *cls, PyObject *arg)
{ … }
PyDoc_STRVAR(object_init_subclass_doc,
"This method is called when a class is subclassed.\n"
"\n"
"The default implementation does nothing. It may be\n"
"overridden to extend subclasses.\n");
static PyObject *
object___format___impl(PyObject *self, PyObject *format_spec)
{ … }
static PyObject *
object___sizeof___impl(PyObject *self)
{ … }
static PyObject *
object___dir___impl(PyObject *self)
{ … }
static PyMethodDef object_methods[] = …;
PyDoc_STRVAR(object_doc,
"object()\n--\n\n"
"The base class of the class hierarchy.\n\n"
"When called, it accepts no arguments and returns a new featureless\n"
"instance that has no instance attributes and cannot be given any.\n");
PyTypeObject PyBaseObject_Type = …;
static int
type_add_method(PyTypeObject *type, PyMethodDef *meth)
{ … }
int
_PyType_AddMethod(PyTypeObject *type, PyMethodDef *meth)
{ … }
static int
type_add_methods(PyTypeObject *type)
{ … }
static int
type_add_members(PyTypeObject *type)
{ … }
static int
type_add_getset(PyTypeObject *type)
{ … }
static void
inherit_special(PyTypeObject *type, PyTypeObject *base)
{ … }
static int
overrides_hash(PyTypeObject *type)
{ … }
static int
inherit_slots(PyTypeObject *type, PyTypeObject *base)
{ … }
static int add_operators(PyTypeObject *type);
static int add_tp_new_wrapper(PyTypeObject *type);
#define COLLECTION_FLAGS …
static int
type_ready_pre_checks(PyTypeObject *type)
{ … }
static int
type_ready_set_base(PyTypeObject *type)
{ … }
static int
type_ready_set_type(PyTypeObject *type)
{ … }
static int
type_ready_set_bases(PyTypeObject *type, int initial)
{ … }
static int
type_ready_set_dict(PyTypeObject *type)
{ … }
static int
type_dict_set_doc(PyTypeObject *type)
{ … }
static int
type_ready_fill_dict(PyTypeObject *type)
{ … }
static int
type_ready_preheader(PyTypeObject *type)
{ … }
static int
type_ready_mro(PyTypeObject *type, int initial)
{ … }
static void
type_ready_inherit_as_structs(PyTypeObject *type, PyTypeObject *base)
{ … }
static void
inherit_patma_flags(PyTypeObject *type, PyTypeObject *base) { … }
static int
type_ready_inherit(PyTypeObject *type)
{ … }
static int
type_ready_set_hash(PyTypeObject *type)
{ … }
static int
type_ready_add_subclasses(PyTypeObject *type)
{ … }
static int
type_ready_set_new(PyTypeObject *type, int initial)
{ … }
static int
type_ready_managed_dict(PyTypeObject *type)
{ … }
static int
type_ready_post_checks(PyTypeObject *type)
{ … }
static int
type_ready(PyTypeObject *type, int initial)
{ … }
int
PyType_Ready(PyTypeObject *type)
{ … }
static int
init_static_type(PyInterpreterState *interp, PyTypeObject *self,
int isbuiltin, int initial)
{ … }
int
_PyStaticType_InitForExtension(PyInterpreterState *interp, PyTypeObject *self)
{ … }
int
_PyStaticType_InitBuiltin(PyInterpreterState *interp, PyTypeObject *self)
{ … }
static int
add_subclass(PyTypeObject *base, PyTypeObject *type)
{ … }
static int
add_all_subclasses(PyTypeObject *type, PyObject *bases)
{ … }
static PyObject *
get_subclasses_key(PyTypeObject *type, PyTypeObject *base)
{ … }
static void
remove_subclass(PyTypeObject *base, PyTypeObject *type)
{ … }
static void
remove_all_subclasses(PyTypeObject *type, PyObject *bases)
{ … }
static int
check_num_args(PyObject *ob, int n)
{ … }
static Py_ssize_t
check_pow_args(PyObject *ob)
{ … }
static PyObject *
wrap_lenfunc(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_inquirypred(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_binaryfunc(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_binaryfunc_l(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_binaryfunc_r(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_ternaryfunc(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_ternaryfunc_r(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_unaryfunc(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_indexargfunc(PyObject *self, PyObject *args, void *wrapped)
{ … }
static Py_ssize_t
getindex(PyObject *self, PyObject *arg)
{ … }
static PyObject *
wrap_sq_item(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_sq_setitem(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_sq_delitem(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_objobjproc(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_objobjargproc(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_delitem(PyObject *self, PyObject *args, void *wrapped)
{ … }
static int
hackcheck_unlocked(PyObject *self, setattrofunc func, const char *what)
{ … }
static int
hackcheck(PyObject *self, setattrofunc func, const char *what)
{ … }
static PyObject *
wrap_setattr(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_delattr(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_hashfunc(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_call(PyObject *self, PyObject *args, void *wrapped, PyObject *kwds)
{ … }
static PyObject *
wrap_del(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_richcmpfunc(PyObject *self, PyObject *args, void *wrapped, int op)
{ … }
#undef RICHCMP_WRAPPER
#define RICHCMP_WRAPPER(NAME, OP) …
RICHCMP_WRAPPER(lt, Py_LT)
RICHCMP_WRAPPER(le, Py_LE)
RICHCMP_WRAPPER(eq, Py_EQ)
RICHCMP_WRAPPER(ne, Py_NE)
RICHCMP_WRAPPER(gt, Py_GT)
RICHCMP_WRAPPER(ge, Py_GE)
static PyObject *
wrap_next(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_descr_get(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_descr_set(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_descr_delete(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_buffer(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_releasebuffer(PyObject *self, PyObject *args, void *wrapped)
{ … }
static PyObject *
wrap_init(PyObject *self, PyObject *args, void *wrapped, PyObject *kwds)
{ … }
static PyObject *
tp_new_wrapper(PyObject *self, PyObject *args, PyObject *kwds)
{ … }
static struct PyMethodDef tp_new_methoddef[] = …;
static int
add_tp_new_wrapper(PyTypeObject *type)
{ … }
#define SLOT0(FUNCNAME, DUNDER) …
#define SLOT1(FUNCNAME, DUNDER, ARG1TYPE) …
static int
method_is_overloaded(PyObject *left, PyObject *right, PyObject *name)
{ … }
#define SLOT1BINFULL(FUNCNAME, TESTFUNC, SLOTNAME, DUNDER, RDUNDER) …
#define SLOT1BIN(FUNCNAME, SLOTNAME, DUNDER, RDUNDER) …
static Py_ssize_t
slot_sq_length(PyObject *self)
{ … }
static PyObject *
slot_sq_item(PyObject *self, Py_ssize_t i)
{ … }
static int
slot_sq_ass_item(PyObject *self, Py_ssize_t index, PyObject *value)
{ … }
static int
slot_sq_contains(PyObject *self, PyObject *value)
{ … }
#define slot_mp_length …
SLOT1(slot_mp_subscript, __getitem__, PyObject *)
static int
slot_mp_ass_subscript(PyObject *self, PyObject *key, PyObject *value)
{ … }
SLOT1BIN(…)
SLOT1BIN(…)
SLOT1BIN(…)
SLOT1BIN(…)
SLOT1BIN(…)
SLOT1BIN(…)
static PyObject *slot_nb_power(PyObject *, PyObject *, PyObject *);
SLOT1BINFULL(…)
static PyObject *
slot_nb_power(PyObject *self, PyObject *other, PyObject *modulus)
{ … }
SLOT0(…)
SLOT0(…)
SLOT0(…)
static int
slot_nb_bool(PyObject *self)
{ … }
static PyObject *
slot_nb_index(PyObject *self)
{ … }
SLOT0(…)
SLOT1BIN(…)
SLOT1BIN(…)
SLOT1BIN(…)
SLOT1BIN(…)
SLOT1BIN(…)
SLOT0(…)
SLOT0(…)
SLOT1(slot_nb_inplace_add, __iadd__, PyObject *)
SLOT1(slot_nb_inplace_subtract, __isub__, PyObject *)
SLOT1(slot_nb_inplace_multiply, __imul__, PyObject *)
SLOT1(slot_nb_inplace_matrix_multiply, __imatmul__, PyObject *)
SLOT1(slot_nb_inplace_remainder, __imod__, PyObject *)
static PyObject *
slot_nb_inplace_power(PyObject *self, PyObject * arg1, PyObject *arg2)
{ … }
SLOT1(slot_nb_inplace_lshift, __ilshift__, PyObject *)
SLOT1(slot_nb_inplace_rshift, __irshift__, PyObject *)
SLOT1(slot_nb_inplace_and, __iand__, PyObject *)
SLOT1(slot_nb_inplace_xor, __ixor__, PyObject *)
SLOT1(slot_nb_inplace_or, __ior__, PyObject *)
SLOT1BIN(…)
SLOT1BIN(…)
SLOT1(slot_nb_inplace_floor_divide, __ifloordiv__, PyObject *)
SLOT1(slot_nb_inplace_true_divide, __itruediv__, PyObject *)
static PyObject *
slot_tp_repr(PyObject *self)
{ … }
SLOT0(…)
static Py_hash_t
slot_tp_hash(PyObject *self)
{ … }
static PyObject *
slot_tp_call(PyObject *self, PyObject *args, PyObject *kwds)
{ … }
PyObject *
_Py_slot_tp_getattro(PyObject *self, PyObject *name)
{ … }
static inline PyObject *
call_attribute(PyObject *self, PyObject *attr, PyObject *name)
{ … }
PyObject *
_Py_slot_tp_getattr_hook(PyObject *self, PyObject *name)
{ … }
static int
slot_tp_setattro(PyObject *self, PyObject *name, PyObject *value)
{ … }
static PyObject *name_op[] = …;
static PyObject *
slot_tp_richcompare(PyObject *self, PyObject *other, int op)
{ … }
static PyObject *
slot_tp_iter(PyObject *self)
{ … }
static PyObject *
slot_tp_iternext(PyObject *self)
{ … }
static PyObject *
slot_tp_descr_get(PyObject *self, PyObject *obj, PyObject *type)
{ … }
static int
slot_tp_descr_set(PyObject *self, PyObject *target, PyObject *value)
{ … }
static int
slot_tp_init(PyObject *self, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
slot_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{ … }
static void
slot_tp_finalize(PyObject *self)
{ … }
PyBufferWrapper;
static int
bufferwrapper_traverse(PyBufferWrapper *self, visitproc visit, void *arg)
{ … }
static void
bufferwrapper_dealloc(PyObject *self)
{ … }
static void
bufferwrapper_releasebuf(PyObject *self, Py_buffer *view)
{ … }
static PyBufferProcs bufferwrapper_as_buffer = …;
PyTypeObject _PyBufferWrapper_Type = …;
static int
slot_bf_getbuffer(PyObject *self, Py_buffer *buffer, int flags)
{ … }
static releasebufferproc
releasebuffer_maybe_call_super_unlocked(PyObject *self, Py_buffer *buffer)
{ … }
static void
releasebuffer_maybe_call_super(PyObject *self, Py_buffer *buffer)
{ … }
static void
releasebuffer_call_python(PyObject *self, Py_buffer *buffer)
{ … }
static void
slot_bf_releasebuffer(PyObject *self, Py_buffer *buffer)
{ … }
static PyObject *
slot_am_await(PyObject *self)
{ … }
static PyObject *
slot_am_aiter(PyObject *self)
{ … }
static PyObject *
slot_am_anext(PyObject *self)
{ … }
#undef TPSLOT
#undef FLSLOT
#undef BUFSLOT
#undef AMSLOT
#undef ETSLOT
#undef SQSLOT
#undef MPSLOT
#undef NBSLOT
#undef UNSLOT
#undef IBSLOT
#undef BINSLOT
#undef RBINSLOT
#define TPSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) …
#define FLSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC, FLAGS) …
#define ETSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) …
#define BUFSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) …
#define AMSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) …
#define SQSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) …
#define MPSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) …
#define NBSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) …
#define UNSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) …
#define IBSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) …
#define BINSLOT(NAME, SLOT, FUNCTION, DOC) …
#define RBINSLOT(NAME, SLOT, FUNCTION, DOC) …
#define BINSLOTNOTINFIX(NAME, SLOT, FUNCTION, DOC) …
#define RBINSLOTNOTINFIX(NAME, SLOT, FUNCTION, DOC) …
static pytype_slotdef slotdefs[] = …;
static void **
slotptr(PyTypeObject *type, int ioffset)
{ … }
static void **
resolve_slotdups(PyTypeObject *type, PyObject *name)
{ … }
static pytype_slotdef *
update_one_slot(PyTypeObject *type, pytype_slotdef *p)
{ … }
static int
update_slots_callback(PyTypeObject *type, void *data)
{ … }
static int
update_slot(PyTypeObject *type, PyObject *name)
{ … }
static void
fixup_slot_dispatchers(PyTypeObject *type)
{ … }
static void
update_all_slots(PyTypeObject* type)
{ … }
PyObject *
_PyType_GetSlotWrapperNames(void)
{ … }
static int
type_new_set_names(PyTypeObject *type)
{ … }
static int
type_new_init_subclass(PyTypeObject *type, PyObject *kwds)
{ … }
static int
update_subclasses(PyTypeObject *type, PyObject *attr_name,
update_callback callback, void *data)
{ … }
static int
recurse_down_subclasses(PyTypeObject *type, PyObject *attr_name,
update_callback callback, void *data)
{ … }
static int
slot_inherited(PyTypeObject *type, pytype_slotdef *slotdef, void **slot)
{ … }
static int
add_operators(PyTypeObject *type)
{ … }
int
PyType_Freeze(PyTypeObject *type)
{ … }
superobject;
static PyMemberDef super_members[] = …;
static void
super_dealloc(PyObject *self)
{ … }
static PyObject *
super_repr(PyObject *self)
{ … }
static PyObject *
_super_lookup_descr(PyTypeObject *su_type, PyTypeObject *su_obj_type, PyObject *name)
{ … }
static PyObject *
do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj,
PyTypeObject *su_obj_type, PyObject *name, int *method)
{ … }
static PyObject *
super_getattro(PyObject *self, PyObject *name)
{ … }
static PyTypeObject *
supercheck(PyTypeObject *type, PyObject *obj)
{ … }
PyObject *
_PySuper_Lookup(PyTypeObject *su_type, PyObject *su_obj, PyObject *name, int *method)
{ … }
static PyObject *
super_descr_get(PyObject *self, PyObject *obj, PyObject *type)
{ … }
static int
super_init_without_args(_PyInterpreterFrame *cframe, PyTypeObject **type_p,
PyObject **obj_p)
{ … }
static int super_init_impl(PyObject *self, PyTypeObject *type, PyObject *obj);
static int
super_init(PyObject *self, PyObject *args, PyObject *kwds)
{ … }
static inline int
super_init_impl(PyObject *self, PyTypeObject *type, PyObject *obj) { … }
PyDoc_STRVAR(super_doc,
"super() -> same as super(__class__, <first argument>)\n"
"super(type) -> unbound super object\n"
"super(type, obj) -> bound super object; requires isinstance(obj, type)\n"
"super(type, type2) -> bound super object; requires issubclass(type2, type)\n"
"Typical use to call a cooperative superclass method:\n"
"class C(B):\n"
" def meth(self, arg):\n"
" super().meth(arg)\n"
"This works for class methods too:\n"
"class C(B):\n"
" @classmethod\n"
" def cmeth(cls, arg):\n"
" super().cmeth(arg)\n");
static int
super_traverse(PyObject *self, visitproc visit, void *arg)
{ … }
static PyObject *
super_vectorcall(PyObject *self, PyObject *const *args,
size_t nargsf, PyObject *kwnames)
{ … }
PyTypeObject PySuper_Type = …;