Files
typthon/Modules/_testcapi/util.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

44 lines
1.6 KiB
C

#define NULLABLE(x) do { \
if (x == Ty_None) { \
x = NULL; \
} \
} while (0);
#define RETURN_INT(value) do { \
int _ret = (value); \
if (_ret == -1) { \
assert(TyErr_Occurred()); \
return NULL; \
} \
assert(!TyErr_Occurred()); \
return TyLong_FromLong(_ret); \
} while (0)
#define RETURN_SIZE(value) do { \
Ty_ssize_t _ret = (value); \
if (_ret == -1) { \
assert(TyErr_Occurred()); \
return NULL; \
} \
assert(!TyErr_Occurred()); \
return TyLong_FromSsize_t(_ret); \
} while (0)
/* Marker to check that pointer value was set. */
static const char uninitialized[] = "uninitialized";
#define UNINITIALIZED_PTR ((void *)uninitialized)
/* Marker to check that Ty_ssize_t value was set. */
#define UNINITIALIZED_SIZE ((Ty_ssize_t)236892191)
/* Marker to check that integer value was set. */
#define UNINITIALIZED_INT (63256717)
/*
* Marker to indicate that a NULL parameter would not be allowed
* at runtime but that the test interface will check that it is
* indeed the case.
*
* Use this macro only if passing NULL to the C API would raise
* a catchable exception (and not a fatal exception that would
* crash the interpreter).
*/
#define NULL_WOULD_RAISE(NAME) NAME