From: Jochen Sprickerhof <jspricke@debian.org>
Date: Fri, 5 Nov 2021 09:13:14 +0100
Subject: Make parser not break on py_ssize_t_clean directive from SIP v6.4

---
 sipgen/metasrc/lexer.l  |  1 +
 sipgen/metasrc/parser.y | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/sipgen/metasrc/lexer.l b/sipgen/metasrc/lexer.l
index a52b018..c328202 100644
--- a/sipgen/metasrc/lexer.l
+++ b/sipgen/metasrc/lexer.l
@@ -174,6 +174,7 @@ SIP_QOBJECT                 {return TK_QOBJECT;}
 <directive>timestamp        {return TK_TIMESTAMP;}
 <directive>type             {return TK_TYPE;}
 <directive>use_argument_names   {return TK_USEARGNAMES;}
+<directive>py_ssize_t_clean {return TK_PYSSIZETCLEAN;}
 <directive>use_limited_api  {return TK_USELIMITEDAPI;}
 <directive>all_raise_py_exception   {return TK_ALLRAISEPYEXC;}
 <directive>call_super_init  {return TK_CALLSUPERINIT;}
diff --git a/sipgen/metasrc/parser.y b/sipgen/metasrc/parser.y
index 5623dca..2d98380 100644
--- a/sipgen/metasrc/parser.y
+++ b/sipgen/metasrc/parser.y
@@ -389,6 +389,7 @@ static scopedNameDef *fullyQualifiedName(scopedNameDef *snd);
 %token          TK_TIMESTAMP
 %token          TK_TYPE
 %token          TK_USEARGNAMES
+%token          TK_PYSSIZETCLEAN
 %token          TK_USELIMITEDAPI
 %token          TK_ALLRAISEPYEXC
 %token          TK_CALLSUPERINIT
@@ -2012,6 +2013,18 @@ module_arg: TK_KWARGS '=' TK_STRING_VALUE {
             $$.call_super_init = -1;
             $$.def_error_handler = NULL;
         }
+    |   TK_PYSSIZETCLEAN '=' bool_value {
+            $$.token = TK_PYSSIZETCLEAN;
+
+            $$.c_module = FALSE;
+            $$.kwargs = defaultKwArgs;
+            $$.name = NULL;
+            $$.use_arg_names = FALSE;
+            $$.use_limited_api = FALSE;
+            $$.all_raise_py_exc = FALSE;
+            $$.call_super_init = -1;
+            $$.def_error_handler = NULL;
+        }
     |   TK_USELIMITEDAPI '=' bool_value {
             $$.token = TK_USELIMITEDAPI;
 
