aboutsummaryrefslogtreecommitdiffstats
path: root/src/tools/vppapigen/vppapigen.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/vppapigen/vppapigen.py')
-rwxr-xr-xsrc/tools/vppapigen/vppapigen.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tools/vppapigen/vppapigen.py b/src/tools/vppapigen/vppapigen.py
index 8ae991c9c95..52ffb6a18f1 100755
--- a/src/tools/vppapigen/vppapigen.py
+++ b/src/tools/vppapigen/vppapigen.py
@@ -5,6 +5,7 @@ import ply.lex as lex
import ply.yacc as yacc
import sys
import argparse
+import keyword
import logging
import binascii
import os
@@ -293,6 +294,9 @@ class Field():
def __init__(self, fieldtype, name, limit=None):
self.type = 'Field'
self.fieldtype = fieldtype
+ if name in keyword.kwlist:
+ raise ValueError("Fieldname {!r} is a python keyword and is not "
+ "accessible via the python API. ".format(name))
self.fieldname = name
self.limit = limit