Skip to content
Snippets Groups Projects
Commit d3a4ce73 authored by Frederik Hennig's avatar Frederik Hennig
Browse files

moved itemsize

parent f721e167
No related branches found
No related tags found
No related merge requests found
Pipeline #60468 failed
...@@ -199,7 +199,7 @@ if( !kwargs || !PyDict_Check(kwargs) ) {{ ...@@ -199,7 +199,7 @@ if( !kwargs || !PyDict_Check(kwargs) ) {{
f"Don't know how to cast Python objects to {dtype}" 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( if isinstance(
dtype, (PsUnsignedIntegerType, PsSignedIntegerType, PsIeeeFloatType) dtype, (PsUnsignedIntegerType, PsSignedIntegerType, PsIeeeFloatType)
): ):
......
...@@ -40,6 +40,11 @@ class PsAbstractType(ABC): ...@@ -40,6 +40,11 @@ class PsAbstractType(ABC):
def required_headers(self) -> set[str]: def required_headers(self) -> set[str]:
"""The set of header files required when this type occurs in generated code.""" """The set of header files required when this type occurs in generated code."""
return set() 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 # Internal virtual operations
...@@ -203,11 +208,6 @@ class PsScalarType(PsNumericType, ABC): ...@@ -203,11 +208,6 @@ class PsScalarType(PsNumericType, ABC):
def is_float(self) -> bool: def is_float(self) -> bool:
return isinstance(self, PsIeeeFloatType) return isinstance(self, PsIeeeFloatType)
@property
@abstractmethod
def itemsize(self) -> int:
"""Size of this type's elements in bytes."""
class PsIntegerType(PsScalarType, ABC): class PsIntegerType(PsScalarType, ABC):
"""Class to model signed and unsigned integer types. """Class to model signed and unsigned integer types.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment