Skip to content

PyUtils: Python3 fixes for diff-root

Looking at the latest ART tests in python3 nightlies, e.g. here, the diff-root throws (among other things):

Traceback (most recent call last):
  File "/cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3_Athena_x86_64-centos7-gcc8-opt/2020-07-13T2137/Athena/22.0.16/InstallArea/x86_64-centos7-gcc8-opt/bin/acmd.py", line 50, in <module>
    sys.exit(main())
  File "/cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3_Athena_x86_64-centos7-gcc8-opt/2020-07-13T2137/Athena/22.0.16/InstallArea/x86_64-centos7-gcc8-opt/bin/acmd.py", line 39, in main
    exitcode = cmd.main(args)
  File "/cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3_Athena_x86_64-centos7-gcc8-opt/2020-07-13T2137/Athena/22.0.16/InstallArea/x86_64-centos7-gcc8-opt/python/PyUtils/acmdlib.py", line 77, in __call__
    return self.fct(*args, **kwargs)
  File "/cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3_Athena_x86_64-centos7-gcc8-opt/2020-07-13T2137/Athena/22.0.16/InstallArea/x86_64-centos7-gcc8-opt/python/PyUtils/scripts/diff_root_files.py", line 427, in main
    ndiff = diff_tree(fold, fnew, args)
  File "/cvmfs/atlas-nightlies.cern.ch/repo/sw/master--py3_Athena_x86_64-centos7-gcc8-opt/2020-07-13T2137/Athena/22.0.16/InstallArea/x86_64-centos7-gcc8-opt/python/PyUtils/scripts/diff_root_files.py", line 321, in diff_tree
    d_old[2])))
TypeError: can only concatenate list (not "map") to list

This seems to stem from the fact that type(map(str,{"foo":"bar"})) returns a list in python2, while it returns a map in python3. We now force the result into a list explicitly to workaround this.

Edited by Alaettin Serhan Mete

Merge request reports