Skip to content

Commit

Permalink
Raise an error on unhandled C types
Browse files Browse the repository at this point in the history
The extract_ast.py tool didn't properly catch unhandled C types, and
when that happened a Node attribute could be associated to the wrong
Python type, the one determined from a previous inspected attribute.
  • Loading branch information
lelit committed Feb 27, 2023
1 parent a55695f commit ff06d8f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/extract_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# :Created: sab 27 feb 2021, 19:47:11
# :Author: Lele Gaifax <[email protected]>
# :License: GNU General Public License version 3 or later
# :Copyright: © 2021, 2022 Lele Gaifax
# :Copyright: © 2021, 2022, 2023 Lele Gaifax
#

from datetime import date
Expand Down Expand Up @@ -1020,9 +1020,13 @@ def adaptor(value):
if ctype.endswith('*'):
ptype = G.get(ctype[:-1])
if ptype is None:
raise NotImplementedError(f'unknown {ctype!r}') from None
aname = f'{cls.__name__}.{attr}'
raise NotImplementedError(f'Unhandled C type of {aname}: {ctype}')
else:
ptype = (dict, ptype)
else:
aname = f'{cls.__name__}.{attr}'
raise NotImplementedError(f'Unhandled C type of {aname}: {ctype}')
slots[attr] = SlotTypeInfo(ctype, ptype, adaptor)
Expand Down

0 comments on commit ff06d8f

Please sign in to comment.