Skip to content

Commit 55b5327

Browse files
committed
Add CHECK* checks to GET_INVALID_*TARGET macros
1 parent ede107e commit 55b5327

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Parser/pegen.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ _PyPegen_raise_error(Parser *p, PyObject *errtype, const char *errmsg, ...)
380380
return NULL;
381381
}
382382

383-
384383
void *
385384
_PyPegen_raise_error_known_location(Parser *p, PyObject *errtype,
386385
Py_ssize_t lineno, Py_ssize_t col_offset,

Parser/pegen.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@ typedef enum {
269269
FOR_TARGETS
270270
} TARGETS_TYPE;
271271
expr_ty _PyPegen_get_invalid_target(expr_ty e, TARGETS_TYPE targets_type);
272-
#define GET_INVALID_TARGET(e) _PyPegen_get_invalid_target(e, STAR_TARGETS)
273-
#define GET_INVALID_DEL_TARGET(e) _PyPegen_get_invalid_target(e, DEL_TARGETS)
274-
#define GET_INVALID_FOR_TARGET(e) _PyPegen_get_invalid_target(e, FOR_TARGETS)
272+
#define GET_INVALID_TARGET(e) (expr_ty)CHECK(_PyPegen_get_invalid_target(e, STAR_TARGETS))
273+
#define GET_INVALID_DEL_TARGET(e) (expr_ty)CHECK_NULL_ALLOWED(_PyPegen_get_invalid_target(e, DEL_TARGETS))
274+
#define GET_INVALID_FOR_TARGET(e) (expr_ty)CHECK_NULL_ALLOWED(_PyPegen_get_invalid_target(e, FOR_TARGETS))
275275

276276
void *_PyPegen_arguments_parsing_error(Parser *, expr_ty);
277277
void *_PyPegen_nonparen_genexp_in_call(Parser *p, expr_ty args);

0 commit comments

Comments
 (0)