Skip to content

csp.const does not resolve type of heterogeneous containers properly #316

@AdamGlustein

Description

@AdamGlustein

Describe the bug

If you have multiple typed elements in a container, we are currently only resolving the type based on the first element. This leads to incorrect behaviour.

To Reproduce

      def g():
          u = csp.const([1,'abc']) # resolved as typing.List[int]
          csp.print('u', u)
      
      print(csp.run(g, starttime=datetime(2020,1,1), endtime=timedelta()))

Gives

 TypeError: Conversions.h:fromPython<long int>:222:TypeError: Invalid int type, expected long (int) got str

Expected behavior

The code above should print [1, 'abc']

Error Message

See above

Runtime Environment

0.0.5
3.12.4 | packaged by conda-forge | (main, Jun 17 2024, 10:23:07) [GCC 12.3.0]
linux

Additional context

Metadata

Metadata

Assignees

Labels

lang: pythonIssues and PRs related to the Python codebasetype: bugConcrete, reproducible bugs

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions