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>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-29 17:44:05 +00:00
parent b198f511d2
commit 42e2356c88
367 changed files with 3520 additions and 3520 deletions

View File

@@ -97,7 +97,7 @@ blob_close_impl(pysqlite_Blob *self)
return NULL;
}
close_blob(self);
Ty_RETURN_NONE;
Py_RETURN_NONE;
};
void
@@ -256,7 +256,7 @@ blob_write_impl(pysqlite_Blob *self, Ty_buffer *data)
return NULL;
}
self->offset += (int)data->len;
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
@@ -311,7 +311,7 @@ blob_seek_impl(pysqlite_Blob *self, int offset, int origin)
}
self->offset = offset;
Ty_RETURN_NONE;
Py_RETURN_NONE;
overflow:
TyErr_SetString(TyExc_OverflowError, "seek offset results in overflow");
@@ -373,7 +373,7 @@ blob_exit_impl(pysqlite_Blob *self, TyObject *type, TyObject *val,
return NULL;
}
close_blob(self);
Ty_RETURN_FALSE;
Py_RETURN_FALSE;
}
static Ty_ssize_t
@@ -583,7 +583,7 @@ static TyMethodDef blob_methods[] = {
};
static struct TyMemberDef blob_members[] = {
{"__weaklistoffset__", Ty_T_PYSSIZET, offsetof(pysqlite_Blob, in_weakreflist), Ty_READONLY},
{"__weaklistoffset__", Ty_T_PYSSIZET, offsetof(pysqlite_Blob, in_weakreflist), Py_READONLY},
{NULL},
};

View File

@@ -17,7 +17,7 @@ static TyObject *
blob_close_impl(pysqlite_Blob *self);
static TyObject *
blob_close(TyObject *self, TyObject *Ty_UNUSED(ignored))
blob_close(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return blob_close_impl((pysqlite_Blob *)self);
}
@@ -156,7 +156,7 @@ static TyObject *
blob_tell_impl(pysqlite_Blob *self);
static TyObject *
blob_tell(TyObject *self, TyObject *Ty_UNUSED(ignored))
blob_tell(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return blob_tell_impl((pysqlite_Blob *)self);
}
@@ -174,7 +174,7 @@ static TyObject *
blob_enter_impl(pysqlite_Blob *self);
static TyObject *
blob_enter(TyObject *self, TyObject *Ty_UNUSED(ignored))
blob_enter(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return blob_enter_impl((pysqlite_Blob *)self);
}

View File

@@ -378,7 +378,7 @@ static TyObject *
pysqlite_connection_close_impl(pysqlite_Connection *self);
static TyObject *
pysqlite_connection_close(TyObject *self, TyObject *Ty_UNUSED(ignored))
pysqlite_connection_close(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return pysqlite_connection_close_impl((pysqlite_Connection *)self);
}
@@ -398,7 +398,7 @@ static TyObject *
pysqlite_connection_commit_impl(pysqlite_Connection *self);
static TyObject *
pysqlite_connection_commit(TyObject *self, TyObject *Ty_UNUSED(ignored))
pysqlite_connection_commit(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return pysqlite_connection_commit_impl((pysqlite_Connection *)self);
}
@@ -418,7 +418,7 @@ static TyObject *
pysqlite_connection_rollback_impl(pysqlite_Connection *self);
static TyObject *
pysqlite_connection_rollback(TyObject *self, TyObject *Ty_UNUSED(ignored))
pysqlite_connection_rollback(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return pysqlite_connection_rollback_impl((pysqlite_Connection *)self);
}
@@ -1240,7 +1240,7 @@ static TyObject *
pysqlite_connection_interrupt_impl(pysqlite_Connection *self);
static TyObject *
pysqlite_connection_interrupt(TyObject *self, TyObject *Ty_UNUSED(ignored))
pysqlite_connection_interrupt(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return pysqlite_connection_interrupt_impl((pysqlite_Connection *)self);
}
@@ -1706,7 +1706,7 @@ static TyObject *
pysqlite_connection_enter_impl(pysqlite_Connection *self);
static TyObject *
pysqlite_connection_enter(TyObject *self, TyObject *Ty_UNUSED(ignored))
pysqlite_connection_enter(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return pysqlite_connection_enter_impl((pysqlite_Connection *)self);
}

View File

@@ -163,7 +163,7 @@ static TyObject *
pysqlite_cursor_fetchone_impl(pysqlite_Cursor *self);
static TyObject *
pysqlite_cursor_fetchone(TyObject *self, TyObject *Ty_UNUSED(ignored))
pysqlite_cursor_fetchone(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return pysqlite_cursor_fetchone_impl((pysqlite_Cursor *)self);
}
@@ -250,7 +250,7 @@ static TyObject *
pysqlite_cursor_fetchall_impl(pysqlite_Cursor *self);
static TyObject *
pysqlite_cursor_fetchall(TyObject *self, TyObject *Ty_UNUSED(ignored))
pysqlite_cursor_fetchall(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return pysqlite_cursor_fetchall_impl((pysqlite_Cursor *)self);
}
@@ -325,7 +325,7 @@ static TyObject *
pysqlite_cursor_close_impl(pysqlite_Cursor *self);
static TyObject *
pysqlite_cursor_close(TyObject *self, TyObject *Ty_UNUSED(ignored))
pysqlite_cursor_close(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return pysqlite_cursor_close_impl((pysqlite_Cursor *)self);
}

View File

@@ -52,7 +52,7 @@ static TyObject *
pysqlite_row_keys_impl(pysqlite_Row *self);
static TyObject *
pysqlite_row_keys(TyObject *self, TyObject *Ty_UNUSED(ignored))
pysqlite_row_keys(TyObject *self, TyObject *Py_UNUSED(ignored))
{
return pysqlite_row_keys_impl((pysqlite_Row *)self);
}

View File

@@ -676,7 +676,7 @@ pysqlite_connection_close_impl(pysqlite_Connection *self)
return NULL;
}
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
/*
@@ -733,7 +733,7 @@ pysqlite_connection_commit_impl(pysqlite_Connection *self)
return NULL;
}
}
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
/*[clinic input]
@@ -767,7 +767,7 @@ pysqlite_connection_rollback_impl(pysqlite_Connection *self)
return NULL;
}
}
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
static int
@@ -1204,7 +1204,7 @@ pysqlite_connection_create_function_impl(pysqlite_Connection *self,
TyErr_SetString(self->OperationalError, "Error creating function");
return NULL;
}
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
#ifdef HAVE_WINDOW_FUNCTIONS
@@ -1358,7 +1358,7 @@ create_window_function_impl(pysqlite_Connection *self, TyTypeObject *cls,
set_error_from_code(self->state, rc);
return NULL;
}
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
#endif
@@ -1405,7 +1405,7 @@ pysqlite_connection_create_aggregate_impl(pysqlite_Connection *self,
TyErr_SetString(self->OperationalError, "Error creating aggregate");
return NULL;
}
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
static int
@@ -1565,7 +1565,7 @@ pysqlite_connection_set_authorizer_impl(pysqlite_Connection *self,
set_callback_context(&self->authorizer_ctx, NULL);
return NULL;
}
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
/*[clinic input]
@@ -1609,7 +1609,7 @@ pysqlite_connection_set_progress_handler_impl(pysqlite_Connection *self,
sqlite3_progress_handler(self->db, n, progress_callback, ctx);
set_callback_context(&self->progress_ctx, ctx);
}
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
/*[clinic input]
@@ -1652,7 +1652,7 @@ pysqlite_connection_set_trace_callback_impl(pysqlite_Connection *self,
set_callback_context(&self->trace_ctx, ctx);
}
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
#ifdef PY_SQLITE_ENABLE_LOAD_EXTENSION
@@ -1688,7 +1688,7 @@ pysqlite_connection_enable_load_extension_impl(pysqlite_Connection *self,
"Error enabling load extension");
return NULL;
} else {
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
}
@@ -1725,7 +1725,7 @@ pysqlite_connection_load_extension_impl(pysqlite_Connection *self,
TyErr_SetString(self->OperationalError, errmsg);
return NULL;
} else {
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
}
#endif
@@ -1746,7 +1746,7 @@ int pysqlite_check_thread(pysqlite_Connection* self)
}
static TyObject *
pysqlite_connection_get_isolation_level(TyObject *op, void *Ty_UNUSED(closure))
pysqlite_connection_get_isolation_level(TyObject *op, void *Py_UNUSED(closure))
{
pysqlite_Connection *self = _pysqlite_Connection_CAST(op);
if (!pysqlite_check_connection(self)) {
@@ -1755,11 +1755,11 @@ pysqlite_connection_get_isolation_level(TyObject *op, void *Ty_UNUSED(closure))
if (self->isolation_level != NULL) {
return TyUnicode_FromString(self->isolation_level);
}
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
static TyObject *
pysqlite_connection_get_total_changes(TyObject *op, void *Ty_UNUSED(closure))
pysqlite_connection_get_total_changes(TyObject *op, void *Py_UNUSED(closure))
{
pysqlite_Connection *self = _pysqlite_Connection_CAST(op);
if (!pysqlite_check_connection(self)) {
@@ -1769,22 +1769,22 @@ pysqlite_connection_get_total_changes(TyObject *op, void *Ty_UNUSED(closure))
}
static TyObject *
pysqlite_connection_get_in_transaction(TyObject *op, void *Ty_UNUSED(closure))
pysqlite_connection_get_in_transaction(TyObject *op, void *Py_UNUSED(closure))
{
pysqlite_Connection *self = _pysqlite_Connection_CAST(op);
if (!pysqlite_check_connection(self)) {
return NULL;
}
if (!sqlite3_get_autocommit(self->db)) {
Ty_RETURN_TRUE;
Py_RETURN_TRUE;
}
Ty_RETURN_FALSE;
Py_RETURN_FALSE;
}
static int
pysqlite_connection_set_isolation_level(TyObject *op,
TyObject *isolation_level,
void *Ty_UNUSED(ignored))
void *Py_UNUSED(ignored))
{
pysqlite_Connection *self = _pysqlite_Connection_CAST(op);
if (isolation_level == NULL) {
@@ -2155,7 +2155,7 @@ pysqlite_connection_backup_impl(pysqlite_Connection *self,
return NULL;
}
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
/*[clinic input]
@@ -2213,7 +2213,7 @@ pysqlite_connection_create_collation_impl(pysqlite_Connection *self,
return NULL;
}
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
#ifdef PY_SQLITE_HAVE_SERIALIZE
@@ -2330,7 +2330,7 @@ deserialize_impl(pysqlite_Connection *self, Ty_buffer *data,
set_error_from_db(self->state, self->db);
return NULL;
}
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
#endif // PY_SQLITE_HAVE_SERIALIZE
@@ -2400,7 +2400,7 @@ pysqlite_connection_exit_impl(pysqlite_Connection *self, TyObject *exc_type,
}
Ty_DECREF(result);
Ty_RETURN_FALSE;
Py_RETURN_FALSE;
}
/*[clinic input]
@@ -2529,7 +2529,7 @@ setconfig_impl(pysqlite_Connection *self, int op, int enable)
TyErr_SetString(self->state->OperationalError, "Unable to set config");
return NULL;
}
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
/*[clinic input]
@@ -2564,23 +2564,23 @@ getconfig_impl(pysqlite_Connection *self, int op)
}
static TyObject *
get_autocommit(TyObject *op, void *Ty_UNUSED(closure))
get_autocommit(TyObject *op, void *Py_UNUSED(closure))
{
pysqlite_Connection *self = _pysqlite_Connection_CAST(op);
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
}
if (self->autocommit == AUTOCOMMIT_ENABLED) {
Ty_RETURN_TRUE;
Py_RETURN_TRUE;
}
if (self->autocommit == AUTOCOMMIT_DISABLED) {
Ty_RETURN_FALSE;
Py_RETURN_FALSE;
}
return TyLong_FromLong(LEGACY_TRANSACTION_CONTROL);
}
static int
set_autocommit(TyObject *op, TyObject *val, void *Ty_UNUSED(closure))
set_autocommit(TyObject *op, TyObject *val, void *Py_UNUSED(closure))
{
pysqlite_Connection *self = _pysqlite_Connection_CAST(op);
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
@@ -2607,7 +2607,7 @@ set_autocommit(TyObject *op, TyObject *val, void *Ty_UNUSED(closure))
}
static TyObject *
get_sig(TyObject *Ty_UNUSED(self), void *Ty_UNUSED(closure))
get_sig(TyObject *Py_UNUSED(self), void *Py_UNUSED(closure))
{
return TyUnicode_FromString("(sql, /)");
}
@@ -2660,16 +2660,16 @@ static TyMethodDef connection_methods[] = {
static struct TyMemberDef connection_members[] =
{
{"Warning", _Ty_T_OBJECT, offsetof(pysqlite_Connection, Warning), Ty_READONLY},
{"Error", _Ty_T_OBJECT, offsetof(pysqlite_Connection, Error), Ty_READONLY},
{"InterfaceError", _Ty_T_OBJECT, offsetof(pysqlite_Connection, InterfaceError), Ty_READONLY},
{"DatabaseError", _Ty_T_OBJECT, offsetof(pysqlite_Connection, DatabaseError), Ty_READONLY},
{"DataError", _Ty_T_OBJECT, offsetof(pysqlite_Connection, DataError), Ty_READONLY},
{"OperationalError", _Ty_T_OBJECT, offsetof(pysqlite_Connection, OperationalError), Ty_READONLY},
{"IntegrityError", _Ty_T_OBJECT, offsetof(pysqlite_Connection, IntegrityError), Ty_READONLY},
{"InternalError", _Ty_T_OBJECT, offsetof(pysqlite_Connection, InternalError), Ty_READONLY},
{"ProgrammingError", _Ty_T_OBJECT, offsetof(pysqlite_Connection, ProgrammingError), Ty_READONLY},
{"NotSupportedError", _Ty_T_OBJECT, offsetof(pysqlite_Connection, NotSupportedError), Ty_READONLY},
{"Warning", _Ty_T_OBJECT, offsetof(pysqlite_Connection, Warning), Py_READONLY},
{"Error", _Ty_T_OBJECT, offsetof(pysqlite_Connection, Error), Py_READONLY},
{"InterfaceError", _Ty_T_OBJECT, offsetof(pysqlite_Connection, InterfaceError), Py_READONLY},
{"DatabaseError", _Ty_T_OBJECT, offsetof(pysqlite_Connection, DatabaseError), Py_READONLY},
{"DataError", _Ty_T_OBJECT, offsetof(pysqlite_Connection, DataError), Py_READONLY},
{"OperationalError", _Ty_T_OBJECT, offsetof(pysqlite_Connection, OperationalError), Py_READONLY},
{"IntegrityError", _Ty_T_OBJECT, offsetof(pysqlite_Connection, IntegrityError), Py_READONLY},
{"InternalError", _Ty_T_OBJECT, offsetof(pysqlite_Connection, InternalError), Py_READONLY},
{"ProgrammingError", _Ty_T_OBJECT, offsetof(pysqlite_Connection, ProgrammingError), Py_READONLY},
{"NotSupportedError", _Ty_T_OBJECT, offsetof(pysqlite_Connection, NotSupportedError), Py_READONLY},
{"row_factory", _Ty_T_OBJECT, offsetof(pysqlite_Connection, row_factory)},
{"text_factory", _Ty_T_OBJECT, offsetof(pysqlite_Connection, text_factory)},
{NULL}

View File

@@ -1150,7 +1150,7 @@ pysqlite_cursor_fetchone_impl(pysqlite_Cursor *self)
row = pysqlite_cursor_iternext((TyObject *)self);
if (!row && !TyErr_Occurred()) {
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
return row;
@@ -1245,7 +1245,7 @@ static TyObject *
pysqlite_cursor_setinputsizes_impl(pysqlite_Cursor *self, TyObject *sizes)
/*[clinic end generated code: output=a06c12790bd05f2e input=de7950a3aec79bdf]*/
{
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
/*[clinic input]
@@ -1263,7 +1263,7 @@ pysqlite_cursor_setoutputsize_impl(pysqlite_Cursor *self, TyObject *size,
TyObject *column)
/*[clinic end generated code: output=018d7e9129d45efe input=607a6bece8bbb273]*/
{
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
/*[clinic input]
@@ -1298,7 +1298,7 @@ pysqlite_cursor_close_impl(pysqlite_Cursor *self)
self->closed = 1;
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
static TyMethodDef cursor_methods[] = {
@@ -1316,13 +1316,13 @@ static TyMethodDef cursor_methods[] = {
static struct TyMemberDef cursor_members[] =
{
{"connection", _Ty_T_OBJECT, offsetof(pysqlite_Cursor, connection), Ty_READONLY},
{"description", _Ty_T_OBJECT, offsetof(pysqlite_Cursor, description), Ty_READONLY},
{"connection", _Ty_T_OBJECT, offsetof(pysqlite_Cursor, connection), Py_READONLY},
{"description", _Ty_T_OBJECT, offsetof(pysqlite_Cursor, description), Py_READONLY},
{"arraysize", Ty_T_INT, offsetof(pysqlite_Cursor, arraysize), 0},
{"lastrowid", _Ty_T_OBJECT, offsetof(pysqlite_Cursor, lastrowid), Ty_READONLY},
{"rowcount", Ty_T_LONG, offsetof(pysqlite_Cursor, rowcount), Ty_READONLY},
{"lastrowid", _Ty_T_OBJECT, offsetof(pysqlite_Cursor, lastrowid), Py_READONLY},
{"rowcount", Ty_T_LONG, offsetof(pysqlite_Cursor, rowcount), Py_READONLY},
{"row_factory", _Ty_T_OBJECT, offsetof(pysqlite_Cursor, row_factory), 0},
{"__weaklistoffset__", Ty_T_PYSSIZET, offsetof(pysqlite_Cursor, in_weakreflist), Ty_READONLY},
{"__weaklistoffset__", Ty_T_PYSSIZET, offsetof(pysqlite_Cursor, in_weakreflist), Py_READONLY},
{NULL}
};

View File

@@ -140,7 +140,7 @@ pysqlite_register_adapter_impl(TyObject *module, TyTypeObject *type,
return NULL;
}
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
/*[clinic input]
@@ -194,7 +194,7 @@ pysqlite_enable_callback_trace_impl(TyObject *module, int enable)
pysqlite_state *state = pysqlite_get_state(module);
state->enable_callback_tracebacks = enable;
Ty_RETURN_NONE;
Py_RETURN_NONE;
}
/*[clinic input]

View File

@@ -109,7 +109,7 @@ pysqlite_row_item(TyObject *op, Ty_ssize_t idx)
static int
equal_ignore_case(TyObject *left, TyObject *right)
{
int eq = PyObject_RichCompareBool(left, right, Ty_EQ);
int eq = PyObject_RichCompareBool(left, right, Py_EQ);
if (eq) { /* equal or error */
return eq;
}
@@ -238,23 +238,23 @@ pysqlite_row_hash(TyObject *op)
static TyObject *
pysqlite_row_richcompare(TyObject *op, TyObject *opother, int opid)
{
if (opid != Ty_EQ && opid != Ty_NE)
Ty_RETURN_NOTIMPLEMENTED;
if (opid != Py_EQ && opid != Py_NE)
Py_RETURN_NOTIMPLEMENTED;
pysqlite_Row *self = _pysqlite_Row_CAST(op);
pysqlite_state *state = pysqlite_get_state_by_type(Ty_TYPE(self));
if (PyObject_TypeCheck(opother, state->RowType)) {
pysqlite_Row *other = (pysqlite_Row *)opother;
int eq = PyObject_RichCompareBool(self->description, other->description, Ty_EQ);
int eq = PyObject_RichCompareBool(self->description, other->description, Py_EQ);
if (eq < 0) {
return NULL;
}
if (eq) {
return PyObject_RichCompare(self->data, other->data, opid);
}
return TyBool_FromLong(opid != Ty_EQ);
return TyBool_FromLong(opid != Py_EQ);
}
Ty_RETURN_NOTIMPLEMENTED;
Py_RETURN_NOTIMPLEMENTED;
}
static TyMethodDef row_methods[] = {