Files
typthon/Include/cpython/classobject.h
copilot-swe-agent[bot] b198f511d2 Rename Py_ to Ty_ throughout C API
Massive automated renaming of all Py_/PyObject/etc. prefixes to Ty_/TyObject/etc.
This includes:
- All public API types (TyObject, TyTypeObject, etc.)
- All public API functions (Ty_Initialize, Ty_BuildValue, etc.)
- All internal API (_Ty_ prefixes)
- Reference counting macros (Ty_INCREF, Ty_DECREF, etc.)
- Type flags (Ty_TPFLAGS_*)
- Debug flags (Ty_DEBUG, Ty_TRACE_REFS, etc.)
- All object type APIs (TyList_, TyDict_, TyUnicode_, etc.)

This changes over 60,000 occurrences across 1000+ files.

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
2025-12-29 17:37:49 +00:00

72 lines
2.2 KiB
C

/* Former class object interface -- now only bound methods are here */
/* Revealing some structures (not for general use) */
#ifndef Ty_LIMITED_API
#ifndef Ty_CLASSOBJECT_H
#define Ty_CLASSOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
PyObject_HEAD
TyObject *im_func; /* The callable object implementing the method */
TyObject *im_self; /* The instance it is bound to */
TyObject *im_weakreflist; /* List of weak references */
vectorcallfunc vectorcall;
} PyMethodObject;
PyAPI_DATA(TyTypeObject) TyMethod_Type;
#define TyMethod_Check(op) Ty_IS_TYPE((op), &TyMethod_Type)
PyAPI_FUNC(TyObject *) TyMethod_New(TyObject *, TyObject *);
PyAPI_FUNC(TyObject *) TyMethod_Function(TyObject *);
PyAPI_FUNC(TyObject *) TyMethod_Self(TyObject *);
#define _PyMethod_CAST(meth) \
(assert(TyMethod_Check(meth)), _Ty_CAST(PyMethodObject*, meth))
/* Static inline functions for direct access to these values.
Type checks are *not* done, so use with care. */
static inline TyObject* TyMethod_GET_FUNCTION(TyObject *meth) {
return _PyMethod_CAST(meth)->im_func;
}
#define TyMethod_GET_FUNCTION(meth) TyMethod_GET_FUNCTION(_TyObject_CAST(meth))
static inline TyObject* TyMethod_GET_SELF(TyObject *meth) {
return _PyMethod_CAST(meth)->im_self;
}
#define TyMethod_GET_SELF(meth) TyMethod_GET_SELF(_TyObject_CAST(meth))
typedef struct {
PyObject_HEAD
TyObject *func;
} PyInstanceMethodObject;
PyAPI_DATA(TyTypeObject) PyInstanceMethod_Type;
#define PyInstanceMethod_Check(op) Ty_IS_TYPE((op), &PyInstanceMethod_Type)
PyAPI_FUNC(TyObject *) PyInstanceMethod_New(TyObject *);
PyAPI_FUNC(TyObject *) PyInstanceMethod_Function(TyObject *);
#define _PyInstanceMethod_CAST(meth) \
(assert(PyInstanceMethod_Check(meth)), \
_Ty_CAST(PyInstanceMethodObject*, meth))
/* Static inline function for direct access to these values.
Type checks are *not* done, so use with care. */
static inline TyObject* PyInstanceMethod_GET_FUNCTION(TyObject *meth) {
return _PyInstanceMethod_CAST(meth)->func;
}
#define PyInstanceMethod_GET_FUNCTION(meth) PyInstanceMethod_GET_FUNCTION(_TyObject_CAST(meth))
#ifdef __cplusplus
}
#endif
#endif // !Ty_CLASSOBJECT_H
#endif // !Ty_LIMITED_API