Skip to content

Commit b3f0b64

Browse files
committed
cleanup merge
1 parent 4b391b1 commit b3f0b64

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Python/symtable.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,14 +2300,19 @@ symtable_visit_type_param_bound_or_default(
23002300
"used for type parameter", name);
23012301
PyErr_SetObject(PyExc_SyntaxError, error_msg);
23022302
Py_DECREF(error_msg);
2303-
SET_ERROR_LOCATION(st->st_filename, LOCATION(tp));
2303+
PyErr_RangedSyntaxLocationObject(st->st_filename,
2304+
tp->lineno,
2305+
tp->col_offset + 1,
2306+
tp->end_lineno,
2307+
tp->end_col_offset + 1);
23042308
return 0;
23052309
}
23062310

23072311
if (e) {
23082312
int is_in_class = st->st_cur->ste_can_see_class_scope;
23092313
if (!symtable_enter_block(st, name, TypeVariableBlock, (void *)tp, LOCATION(e))) {
23102314
return 0;
2315+
}
23112316

23122317
st->st_cur->ste_can_see_class_scope = is_in_class;
23132318
if (is_in_class && !symtable_add_def(st, &_Py_ID(__classdict__), USE, LOCATION(e))) {
@@ -2351,12 +2356,12 @@ symtable_visit_type_param(struct symtable *st, type_param_ty tp)
23512356
// The only requirement for the key is that it is unique and it matches the logic in
23522357
// compile.c where the scope is retrieved.
23532358
if (!symtable_visit_type_param_bound_or_default(st, tp->v.TypeVar.bound, tp->v.TypeVar.name,
2354-
(void *)tp, ste_scope_info)) {
2359+
tp, ste_scope_info)) {
23552360
VISIT_QUIT(st, 0);
23562361
}
23572362

23582363
if (!symtable_visit_type_param_bound_or_default(st, tp->v.TypeVar.default_value, tp->v.TypeVar.name,
2359-
(void *)((uintptr_t)tp + 1), "a TypeVar default")) {
2364+
(type_param_ty)((uintptr_t)tp + 1), "a TypeVar default")) {
23602365
VISIT_QUIT(st, 0);
23612366
}
23622367
break;
@@ -2366,7 +2371,7 @@ symtable_visit_type_param(struct symtable *st, type_param_ty tp)
23662371
}
23672372

23682373
if (!symtable_visit_type_param_bound_or_default(st, tp->v.TypeVarTuple.default_value, tp->v.TypeVarTuple.name,
2369-
(void *)tp, "a TypeVarTuple default")) {
2374+
tp, "a TypeVarTuple default")) {
23702375
VISIT_QUIT(st, 0);
23712376
}
23722377
break;
@@ -2376,7 +2381,7 @@ symtable_visit_type_param(struct symtable *st, type_param_ty tp)
23762381
}
23772382

23782383
if (!symtable_visit_type_param_bound_or_default(st, tp->v.ParamSpec.default_value, tp->v.ParamSpec.name,
2379-
(void *)tp, "a ParamSpec default")) {
2384+
tp, "a ParamSpec default")) {
23802385
VISIT_QUIT(st, 0);
23812386
}
23822387
break;

0 commit comments

Comments
 (0)