Copy head_parsers list on construct. (#150)

We need to create a copy of the head_parsers.
Otherwise the self.value_formats contains just a reference to
head_parsers.
But the self.value_formats is modified in the _parse_values, causing
invalid values in the head_parsers list.
This commit is contained in:
dupondje 2024-03-12 11:14:43 +01:00 committed by GitHub
parent bc35a051f2
commit 1ce0925b61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -335,7 +335,7 @@ class ProfileGenericParser(DSMRObjectParser):
"""
def __init__(self, buffer_types, head_parsers, parsers_for_unidentified):
self.value_formats = head_parsers
self.value_formats = head_parsers.copy()
self.buffer_types = buffer_types
self.parsers_for_unidentified = parsers_for_unidentified