Files
typthon/Objects/stringlib/ctype.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

117 lines
3.0 KiB
C

#if STRINGLIB_IS_UNICODE
# error "ctype.h only compatible with byte-wise strings"
#endif
#include "pycore_bytes_methods.h"
static TyObject*
stringlib_isspace(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return _Ty_bytes_isspace(STRINGLIB_STR(self), STRINGLIB_LEN(self));
}
static TyObject*
stringlib_isalpha(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return _Ty_bytes_isalpha(STRINGLIB_STR(self), STRINGLIB_LEN(self));
}
static TyObject*
stringlib_isalnum(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return _Ty_bytes_isalnum(STRINGLIB_STR(self), STRINGLIB_LEN(self));
}
static TyObject*
stringlib_isascii(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return _Ty_bytes_isascii(STRINGLIB_STR(self), STRINGLIB_LEN(self));
}
static TyObject*
stringlib_isdigit(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return _Ty_bytes_isdigit(STRINGLIB_STR(self), STRINGLIB_LEN(self));
}
static TyObject*
stringlib_islower(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return _Ty_bytes_islower(STRINGLIB_STR(self), STRINGLIB_LEN(self));
}
static TyObject*
stringlib_isupper(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return _Ty_bytes_isupper(STRINGLIB_STR(self), STRINGLIB_LEN(self));
}
static TyObject*
stringlib_istitle(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return _Ty_bytes_istitle(STRINGLIB_STR(self), STRINGLIB_LEN(self));
}
/* functions that return a new object partially translated by ctype funcs: */
static TyObject*
stringlib_lower(TyObject *self, TyObject *Py_UNUSED(ignored))
{
TyObject* newobj;
newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
if (!newobj)
return NULL;
_Ty_bytes_lower(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
STRINGLIB_LEN(self));
return newobj;
}
static TyObject*
stringlib_upper(TyObject *self, TyObject *Py_UNUSED(ignored))
{
TyObject* newobj;
newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
if (!newobj)
return NULL;
_Ty_bytes_upper(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
STRINGLIB_LEN(self));
return newobj;
}
static TyObject*
stringlib_title(TyObject *self, TyObject *Py_UNUSED(ignored))
{
TyObject* newobj;
newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
if (!newobj)
return NULL;
_Ty_bytes_title(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
STRINGLIB_LEN(self));
return newobj;
}
static TyObject*
stringlib_capitalize(TyObject *self, TyObject *Py_UNUSED(ignored))
{
TyObject* newobj;
newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
if (!newobj)
return NULL;
_Ty_bytes_capitalize(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
STRINGLIB_LEN(self));
return newobj;
}
static TyObject*
stringlib_swapcase(TyObject *self, TyObject *Py_UNUSED(ignored))
{
TyObject* newobj;
newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self));
if (!newobj)
return NULL;
_Ty_bytes_swapcase(STRINGLIB_STR(newobj), STRINGLIB_STR(self),
STRINGLIB_LEN(self));
return newobj;
}