From 803ac809f0a2112222c1baa3b3fc9f01852d1ea7 Mon Sep 17 00:00:00 2001
From: Jean-Louis Dupond <jean-louis@dupond.be>
Date: Tue, 12 Mar 2024 10:57:32 +0100
Subject: [PATCH] Copy head_parsers list on construct.

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.
---
 dsmr_parser/parsers.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dsmr_parser/parsers.py b/dsmr_parser/parsers.py
index 61515fc..d49d2bd 100644
--- a/dsmr_parser/parsers.py
+++ b/dsmr_parser/parsers.py
@@ -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