From f5c02edf2feb80e70a4c8932e7af782f546ea55c Mon Sep 17 00:00:00 2001
From: thibault allenet <thibault.allenet@cea.fr>
Date: Thu, 21 Nov 2024 16:30:13 +0000
Subject: [PATCH] Export when Aidge Datatype isn't convertible into cpp type
 then set cpp export type to None

---
 aidge_core/export_utils/data_conversion.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/aidge_core/export_utils/data_conversion.py b/aidge_core/export_utils/data_conversion.py
index 401fc39f2..5333c6a3b 100644
--- a/aidge_core/export_utils/data_conversion.py
+++ b/aidge_core/export_utils/data_conversion.py
@@ -19,6 +19,8 @@ datatype_converter_aide2c = {
 def aidge2c(datatype):
     """Convert a aidge datatype to C type
 
+    If the type is not convertible to a C type (e.g. int4), return None and raise a warning.
+
     :param datatype: Aidge datatype to convert
     :type datatype: :py:object:`aidge_core.DataType`
     :return: A string representing the C type
@@ -27,4 +29,6 @@ def aidge2c(datatype):
     if datatype in datatype_converter_aide2c:
         return datatype_converter_aide2c[datatype]
     else:
-        raise ValueError(f"Unsupported {datatype} aidge datatype")
+        # raise ValueError(f"Unsupported {datatype} aidge datatype")
+        aidge_core.Log.warn(f"Unsupported conversion of {datatype} (aidge datatype) to a C type.")
+        return None
-- 
GitLab