Merge pull request #638 from cool-RR:patch-1

PiperOrigin-RevId: 494142429
Change-Id: Ic279ab235b5c8dd0fb467495ee8136b7fcab56c4
This commit is contained in:
Copybara-Service
2022-12-09 05:01:11 -08:00
+5 -4
View File
@@ -128,15 +128,16 @@ def parse_type(
"""Parses a string that represents a C type into an AST node."""
try:
type_str_stack = _peel_nested_parens(type_name.strip())
except AssertionError:
raise ValueError(f'{type_name!r} contains incorrectly nested parentheses')
except AssertionError as e:
raise ValueError(f'{type_name!r} contains incorrectly nested '
f'parentheses') from e
result = None
while type_str_stack:
try:
result = _parse_maybe_array(type_str_stack.pop(), result)
except AssertionError:
raise ValueError(f'invalid type name {type_name!r}')
except AssertionError as e:
raise ValueError(f'invalid type name {type_name!r}') from e
assert result # hint for pytype that `result` isn't None
return result