From d3a4ce7355fbe65852acb9d8b0cf11124a2ea11d Mon Sep 17 00:00:00 2001
From: Frederik Hennig <frederik.hennig@fau.de>
Date: Thu, 18 Jan 2024 17:39:36 +0100
Subject: [PATCH] moved itemsize

---
 src/pystencils/nbackend/jit/cpu_extension_module.py |  2 +-
 src/pystencils/nbackend/types/basic_types.py        | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/pystencils/nbackend/jit/cpu_extension_module.py b/src/pystencils/nbackend/jit/cpu_extension_module.py
index 3b67fa45f..1859ec661 100644
--- a/src/pystencils/nbackend/jit/cpu_extension_module.py
+++ b/src/pystencils/nbackend/jit/cpu_extension_module.py
@@ -199,7 +199,7 @@ if( !kwargs || !PyDict_Check(kwargs) ) {{
                     f"Don't know how to cast Python objects to {dtype}"
                 )
 
-    def _type_char(self, dtype: PsScalarType) -> str | None:
+    def _type_char(self, dtype: PsAbstractType) -> str | None:
         if isinstance(
             dtype, (PsUnsignedIntegerType, PsSignedIntegerType, PsIeeeFloatType)
         ):
diff --git a/src/pystencils/nbackend/types/basic_types.py b/src/pystencils/nbackend/types/basic_types.py
index a2b219658..ad123148e 100644
--- a/src/pystencils/nbackend/types/basic_types.py
+++ b/src/pystencils/nbackend/types/basic_types.py
@@ -40,6 +40,11 @@ class PsAbstractType(ABC):
     def required_headers(self) -> set[str]:
         """The set of header files required when this type occurs in generated code."""
         return set()
+    
+    @property
+    def itemsize(self) -> int | None:
+        """If this type has a valid in-memory size, return that size."""
+        return None
 
     #   -------------------------------------------------------------------------------------------
     #   Internal virtual operations
@@ -203,11 +208,6 @@ class PsScalarType(PsNumericType, ABC):
     def is_float(self) -> bool:
         return isinstance(self, PsIeeeFloatType)
 
-    @property
-    @abstractmethod
-    def itemsize(self) -> int:
-        """Size of this type's elements in bytes."""
-
 
 class PsIntegerType(PsScalarType, ABC):
     """Class to model signed and unsigned integer types.
-- 
GitLab