Fix final remaining Py_ patterns

- Fixed Py_CONSTANT_* → Ty_CONSTANT_*
- Fixed Py_UNREACHABLE → Ty_UNREACHABLE
- Fixed Py_*_input constants (file_input, single_input, eval_input, func_type_input)
- Fixed _Py_COMP_DIAG_* compiler diagnostic macros

Build continues to progress toward completion.

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-29 18:43:58 +00:00
parent 0f2e4eb3fd
commit 4880786dfa
8 changed files with 17 additions and 17 deletions

View File

@@ -1776,7 +1776,7 @@ PyCursesWindow_getstr(TyObject *op, TyObject *args)
if (rtn == ERR) {
Ty_DECREF(res);
return Ty_GetConstant(Py_CONSTANT_EMPTY_BYTES);
return Ty_GetConstant(Ty_CONSTANT_EMPTY_BYTES);
}
_TyBytes_Resize(&res, strlen(buf)); // 'res' is set to NULL on failure
return res;
@@ -1951,7 +1951,7 @@ PyCursesWindow_instr(TyObject *op, TyObject *args)
if (rtn == ERR) {
Ty_DECREF(res);
return Ty_GetConstant(Py_CONSTANT_EMPTY_BYTES);
return Ty_GetConstant(Ty_CONSTANT_EMPTY_BYTES);
}
_TyBytes_Resize(&res, strlen(buf)); // 'res' is set to NULL on failure
return res;

View File

@@ -531,10 +531,10 @@ static void
pymain_set_inspect(PyConfig *config, int inspect)
{
config->inspect = inspect;
_Py_COMP_DIAG_PUSH
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
_Ty_COMP_DIAG_PUSH
_Ty_COMP_DIAG_IGNORE_DEPR_DECLS
Ty_InspectFlag = inspect;
_Py_COMP_DIAG_POP
_Ty_COMP_DIAG_POP
}

View File

@@ -5869,7 +5869,7 @@ socket_gethostname(TyObject *self, TyObject *unused)
return TyErr_SetFromWindowsErr(0);
if (size == 0)
return Ty_GetConstant(Py_CONSTANT_EMPTY_STR);
return Ty_GetConstant(Ty_CONSTANT_EMPTY_STR);
/* MSDN says ERROR_MORE_DATA may occur because DNS allows longer
names */

View File

@@ -2281,7 +2281,7 @@ long_format_binary(TyObject *aa, int base, int alternate,
bits = 1;
break;
default:
Py_UNREACHABLE();
Ty_UNREACHABLE();
}
/* Compute exact length 'sz' of output string. */
@@ -5550,7 +5550,7 @@ long_bitwise(PyLongObject *a,
size_z = negb ? size_b : size_a;
break;
default:
Py_UNREACHABLE();
Ty_UNREACHABLE();
}
/* We allow an extra digit if z is negative, to make sure that
@@ -5577,7 +5577,7 @@ long_bitwise(PyLongObject *a,
z->long_value.ob_digit[i] = a->long_value.ob_digit[i] ^ b->long_value.ob_digit[i];
break;
default:
Py_UNREACHABLE();
Ty_UNREACHABLE();
}
/* Copy any remaining digits of a, inverting if necessary. */

View File

@@ -151,7 +151,7 @@ _TyPegen_seq_count_dots(asdl_seq *seq)
number_of_dots += 1;
break;
default:
Py_UNREACHABLE();
Ty_UNREACHABLE();
}
}
@@ -1604,7 +1604,7 @@ _build_concatenated_bytes(Parser *p, asdl_expr_seq *strings, int lineno,
Ty_ssize_t len = asdl_seq_LEN(strings);
assert(len > 0);
TyObject* res = Ty_GetConstant(Py_CONSTANT_EMPTY_BYTES);
TyObject* res = Ty_GetConstant(Ty_CONSTANT_EMPTY_BYTES);
/* Bytes literals never get a kind, but just for consistency
since they are represented as Constant nodes, we'll mirror

8
Parser/parser.c generated
View File

@@ -38040,13 +38040,13 @@ _TyPegen_parse(Parser *p)
// Run parser
void *result = NULL;
if (p->start_rule == Py_file_input) {
if (p->start_rule == Ty_file_input) {
result = file_rule(p);
} else if (p->start_rule == Py_single_input) {
} else if (p->start_rule == Ty_single_input) {
result = interactive_rule(p);
} else if (p->start_rule == Py_eval_input) {
} else if (p->start_rule == Ty_eval_input) {
result = eval_rule(p);
} else if (p->start_rule == Py_func_type_input) {
} else if (p->start_rule == Ty_func_type_input) {
result = func_type_rule(p);
}

View File

@@ -127,7 +127,7 @@ expr_context_name(expr_context_ty ctx)
return "Del";
// No default case so compiler emits warning for unhandled cases
}
Py_UNREACHABLE();
Ty_UNREACHABLE();
}
static int

View File

@@ -107,7 +107,7 @@ context_event_name(PyContextEvent event) {
default:
return "?";
}
Py_UNREACHABLE();
Ty_UNREACHABLE();
}
static void