Skip to content

Commit

Permalink
Copy head_parsers list on construct. (#150)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dupondje committed Mar 12, 2024
1 parent bc35a05 commit 1ce0925
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dsmr_parser/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 1ce0925

Please sign in to comment.