casper-astro / xml2vhdl

Python code to generate AXI4Lite VHDL register interfaces and Interconnect from a XML memory map specification.
Other
5 stars 3 forks source link

Deprecated way of checking an empty list #27

Open bgodfrey opened 3 weeks ago

bgodfrey commented 3 weeks ago

On line 426 of scripts/python/xml2vhdl-ox/xml2vhdl/helper/slave.py, there is the line:

if tree_dict[bit_path] != []:

This throws an exception if the object is not a list for Python version >= 3.12. A few ways to change it:

  1. Cast the tree_dict[bit_path] as a list
  2. if len(tree_dict[bit_path]) > 0: I think that this will fail for empty multidimensional arrays though
  3. If you know that the array is a numpy array, then you change check if tree_dict[bit_path].size > 0

There are probably more. Raising as an issue since I'm not sure how we want to (or if we want to) fix it.

jkocz commented 6 days ago

Assigning a few people to start the discussion, what is the best options with this one?