christoph2 / pyA2L

ASAM ASAP2 Library for Python
GNU General Public License v2.0
138 stars 71 forks source link

Error parsing two A2L files with overlapping characteristics #53

Open PHochmann opened 4 months ago

PHochmann commented 4 months ago

When I parse two A2L in separate instances, e.g.

db = DB()
session = db.import_a2l(
    a2l_path, in_memory=False, remove_existing=True
)

Whenever I parsed another A2L before, the overlapping characteristics (i.e. same name, but different address) get the address from the first A2L, not the second. Is there some global state in the background? a2l_path is different, I tried in_memory=False and True and remove_existing=False and True.

EDIT: I've debugged the problem and it seems the problem is that CachedBase does not consider the session when handling the cache but only the name of objects. It should be a combination of session and name that defines a unique cache entry. My workaround was to empty the cache each time I'm parsing a new A2L.

Thanks, Philipp