mirror of
https://github.com/python/cpython.git
synced 2026-04-13 15:20:52 +00:00
[3.13] gh-148157: Check for _PyPegen_add_type_comment_to_arg fail in _PyPegen_name_default_pair (GH-148158) (#148163)
(cherry picked from commit 1795fccfbc)
Co-authored-by: Stan Ulbrych <stan@python.org>
This commit is contained in:
parent
9b576f14bf
commit
4dfcdbe22c
3 changed files with 8 additions and 0 deletions
|
|
@ -398,6 +398,9 @@ def test_non_utf8_type_comment_with_ignore_cookie(self):
|
|||
with self.assertRaises(UnicodeDecodeError):
|
||||
_testcapi.Py_CompileStringExFlags(
|
||||
b"a=1 # type: \x80", "<test>", 256, flags)
|
||||
with self.assertRaises(UnicodeDecodeError):
|
||||
_testcapi.Py_CompileStringExFlags(
|
||||
b"def a(f=8, #type: \x80\n\x80", "<test>", 256, flags)
|
||||
|
||||
def test_func_type_input(self):
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
Fix an unlikely crash when parsing an invalid type comments for function
|
||||
parameters. Found by OSS Fuzz in :oss-fuzz:`492782951`.
|
||||
|
|
@ -434,6 +434,9 @@ _PyPegen_name_default_pair(Parser *p, arg_ty arg, expr_ty value, Token *tc)
|
|||
return NULL;
|
||||
}
|
||||
a->arg = _PyPegen_add_type_comment_to_arg(p, arg, tc);
|
||||
if (!a->arg) {
|
||||
return NULL;
|
||||
}
|
||||
a->value = value;
|
||||
return a;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue