Skip to content
Snippets Groups Projects
Commit 19f6e4a4 authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Declare FieldShapeSymbol and FieldStrideSymbol as strictly positive

parent 6942ed0b
Branches
Tags
1 merge request!16Declare FieldShapeSymbol and FieldStrideSymbol as strictly positive
...@@ -105,8 +105,8 @@ class TypedSymbol(sp.Symbol): ...@@ -105,8 +105,8 @@ class TypedSymbol(sp.Symbol):
obj = TypedSymbol.__xnew_cached_(cls, *args, **kwds) obj = TypedSymbol.__xnew_cached_(cls, *args, **kwds)
return obj return obj
def __new_stage2__(cls, name, dtype): def __new_stage2__(cls, name, dtype, *args, **kwargs):
obj = super(TypedSymbol, cls).__xnew__(cls, name) obj = super(TypedSymbol, cls).__xnew__(cls, name, *args, **kwargs)
try: try:
obj._dtype = create_type(dtype) obj._dtype = create_type(dtype)
except (TypeError, ValueError): except (TypeError, ValueError):
......
...@@ -30,7 +30,7 @@ class FieldStrideSymbol(TypedSymbol): ...@@ -30,7 +30,7 @@ class FieldStrideSymbol(TypedSymbol):
def __new_stage2__(cls, field_name, coordinate): def __new_stage2__(cls, field_name, coordinate):
name = "_stride_{name}_{i}".format(name=field_name, i=coordinate) name = "_stride_{name}_{i}".format(name=field_name, i=coordinate)
obj = super(FieldStrideSymbol, cls).__xnew__(cls, name, STRIDE_DTYPE) obj = super(FieldStrideSymbol, cls).__xnew__(cls, name, STRIDE_DTYPE, positive=True)
obj.field_name = field_name obj.field_name = field_name
obj.coordinate = coordinate obj.coordinate = coordinate
return obj return obj
...@@ -55,7 +55,7 @@ class FieldShapeSymbol(TypedSymbol): ...@@ -55,7 +55,7 @@ class FieldShapeSymbol(TypedSymbol):
def __new_stage2__(cls, field_names, coordinate): def __new_stage2__(cls, field_names, coordinate):
names = "_".join([field_name for field_name in field_names]) names = "_".join([field_name for field_name in field_names])
name = "_size_{names}_{i}".format(names=names, i=coordinate) name = "_size_{names}_{i}".format(names=names, i=coordinate)
obj = super(FieldShapeSymbol, cls).__xnew__(cls, name, SHAPE_DTYPE) obj = super(FieldShapeSymbol, cls).__xnew__(cls, name, SHAPE_DTYPE, positive=True)
obj.field_names = tuple(field_names) obj.field_names = tuple(field_names)
obj.coordinate = coordinate obj.coordinate = coordinate
return obj return obj
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment