Error in debugging python 2/ revit 2022 dynamo 2.10

Hi,
Im experiencing some errors in how python handles exceptions in 2022. It now points at the correct line where the error occurs but sometimes there is a mistake. For example in the below script the exception points at line 970 but is in line 972. This happens more often with if statements. Maybe because Im using the traceback module?
image