Files
typthon/Include/boolobject.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

55 lines
1.6 KiB
C

/* Boolean object interface */
#ifndef Ty_BOOLOBJECT_H
#define Ty_BOOLOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
// TyBool_Type is declared by object.h
#define TyBool_Check(x) Ty_IS_TYPE((x), &TyBool_Type)
/* Ty_False and Ty_True are the only two bools in existence. */
/* Don't use these directly */
PyAPI_DATA(PyLongObject) _Ty_FalseStruct;
PyAPI_DATA(PyLongObject) _Ty_TrueStruct;
/* Use these macros */
#if defined(Ty_LIMITED_API) && Ty_LIMITED_API+0 >= 0x030D0000
# define Ty_False Ty_GetConstantBorrowed(Ty_CONSTANT_FALSE)
# define Ty_True Ty_GetConstantBorrowed(Ty_CONSTANT_TRUE)
#else
# define Ty_False _TyObject_CAST(&_Ty_FalseStruct)
# define Ty_True _TyObject_CAST(&_Ty_TrueStruct)
#endif
// Test if an object is the True singleton, the same as "x is True" in Python.
PyAPI_FUNC(int) Ty_IsTrue(TyObject *x);
#define Ty_IsTrue(x) Ty_Is((x), Ty_True)
// Test if an object is the False singleton, the same as "x is False" in Python.
PyAPI_FUNC(int) Ty_IsFalse(TyObject *x);
#define Ty_IsFalse(x) Ty_Is((x), Ty_False)
/* Macros for returning Ty_True or Ty_False, respectively.
* Only treat Ty_True and Ty_False as immortal in the limited C API 3.12
* and newer. */
#if defined(Ty_LIMITED_API) && Ty_LIMITED_API+0 < 0x030c0000
# define Ty_RETURN_TRUE return Ty_NewRef(Ty_True)
# define Ty_RETURN_FALSE return Ty_NewRef(Ty_False)
#else
# define Ty_RETURN_TRUE return Ty_True
# define Ty_RETURN_FALSE return Ty_False
#endif
/* Function to return a bool from a C long */
PyAPI_FUNC(TyObject *) TyBool_FromLong(long);
#ifdef __cplusplus
}
#endif
#endif /* !Ty_BOOLOBJECT_H */