ARM-software / lisa

Linux Integrated System Analysis
Apache License 2.0
200 stars 119 forks source link

Incorrect type casting in lisa.datautils.series_convert() #2159

Closed douglas-raillard-arm closed 7 months ago

douglas-raillard-arm commented 9 months ago

Describe the bug Converting a series with values higher than 2^63 can lead to a negative value if a signed type is tried first due to Series.astype() behavior:

import pandas as pd
import numpy as np

series = pd.Series([18446743558487338888])
print(series.astype('int64'))

print(series_convert(series, dtype='int64'))

This lambda in lisa.trace needs to be changed so that invalid casts raise an exception:

    astype = lambda dtype: lambda x: x.astype(dtype, copy=False)
douglas-raillard-arm commented 7 months ago

Closing as we are migrating the repo to GitLab. New messages on this conversation should be posted at https://gitlab.arm.com/tooling/lisa/-/issues/2159

Note that you can login with your GitHub account on gitlab.arm.com so it should be painless.