Files
typthon/Include/cpython/cellobject.h
copilot-swe-agent[bot] 42e2356c88 Fix incorrect replacements in Py_ to Ty_ renaming
Fixed several macros and constants that should not have been renamed:
- _Py_CAST, _Py_NULL, _Py_RVALUE (internal utility macros)
- Py_UNUSED (unused parameter macro)
- Py_EQ, Py_NE, Py_LT, Py_LE, Py_GT, Py_GE (comparison constants)
- Py_RETURN_* macros (NONE, TRUE, FALSE, NOTIMPLEMENTED, RICHCOMPARE)
- Py_READONLY, Py_ULL, Py_CONTEXT_SWITCHED
- TyGC_Head in generated clinic files

Build is still in progress with some remaining issues to resolve.

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

51 lines
1.2 KiB
C

/* Cell object interface */
#ifndef Ty_LIMITED_API
#ifndef Ty_CELLOBJECT_H
#define Ty_CELLOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
PyObject_HEAD
/* Content of the cell or NULL when empty */
TyObject *ob_ref;
} PyCellObject;
PyAPI_DATA(TyTypeObject) TyCell_Type;
#define TyCell_Check(op) Ty_IS_TYPE((op), &TyCell_Type)
PyAPI_FUNC(TyObject *) TyCell_New(TyObject *);
PyAPI_FUNC(TyObject *) TyCell_Get(TyObject *);
PyAPI_FUNC(int) TyCell_Set(TyObject *, TyObject *);
static inline TyObject* TyCell_GET(TyObject *op) {
TyObject *res;
PyCellObject *cell;
assert(TyCell_Check(op));
cell = _Py_CAST(PyCellObject*, op);
Ty_BEGIN_CRITICAL_SECTION(cell);
res = cell->ob_ref;
Ty_END_CRITICAL_SECTION();
return res;
}
#define TyCell_GET(op) TyCell_GET(_TyObject_CAST(op))
static inline void TyCell_SET(TyObject *op, TyObject *value) {
PyCellObject *cell;
assert(TyCell_Check(op));
cell = _Py_CAST(PyCellObject*, op);
Ty_BEGIN_CRITICAL_SECTION(cell);
cell->ob_ref = value;
Ty_END_CRITICAL_SECTION();
}
#define TyCell_SET(op, value) TyCell_SET(_TyObject_CAST(op), (value))
#ifdef __cplusplus
}
#endif
#endif /* !Ty_TUPLEOBJECT_H */
#endif /* Ty_LIMITED_API */