Stone-Soup icon indicating copy to clipboard operation
Stone-Soup copied to clipboard

Value Error using a Parameterized Type as a Property (Python 3.12.4)

Open gawebb-dstl opened this issue 4 months ago • 1 comments

I get a Value Error using a Parameterized Type (e.g. list[float]) as a Property in Python 3.12.4. I don't get the error when using Python 3.9.4.

You can recreate this error with the following code snippet.

from stonesoup.base import Base, Property

class A(Base):
	numbers: set[int] = Property()

Output: ValueError: Invalid type specification (set[int]) for property numbers of class A

I've narrowed down the error to line 292 in base.py when isinstance(property_type, type) is used: Python 3.9.4

print(isinstance(set[int], type))
>>> True 

Python 3.12.4

print(isinstance(set[int], type))
>>> False

gawebb-dstl avatar Oct 21 '24 09:10 gawebb-dstl