PrettyPrinter: Check if match is valid before accessing group (#3920)

pull/3932/head
Finkman 2023-01-14 16:07:49 +01:00 committed by GitHub
parent 4c6cde72e5
commit da6b908c4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 14 deletions

View File

@ -14,7 +14,7 @@ class JsonValuePrinter:
return self.val
def json_lookup_function(val):
m = ns_pattern.fullmatch(val.type.strip_typedefs().name)
if m := ns_pattern.fullmatch(str(val.type.strip_typedefs().name)):
name = m.group('name')
if name and name.startswith('basic_json<') and name.endswith('>'):
m = ns_pattern.fullmatch(str(val['m_type']))