From 092e7e2c52b698d88df95f9ae9fcac36819cbc47 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Fri, 6 Jan 2023 20:22:53 +0300 Subject: [PATCH] power_fields: support assignment to same class instance --- src/openpower/decoder/power_fields.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/openpower/decoder/power_fields.py b/src/openpower/decoder/power_fields.py index 856182f3..b0f17909 100644 --- a/src/openpower/decoder/power_fields.py +++ b/src/openpower/decoder/power_fields.py @@ -102,7 +102,8 @@ class Reference: bits = range(bits.start, bits.stop) bits = tuple(bits) - if isinstance(value, int): + if isinstance(value, (int, self.__class__)): + value = int(value) if value.bit_length() > len(bits): raise OverflowError(value) value = _SelectableInt(value=value, bits=len(bits)) -- 2.30.2