Repository: Fatal1ty/mashumaro

Issue:
Inconsistent Application of serialization_strategy
* mashumaro version: 3.2 and 3.3
* Python version: 3.10
* Operating System: macOS

### Description

There is an apparent regression in serialization behavior when the serialization_strategy object is being used and there are multiple properties of the same type on the class being serialized. It worked as I expected in 3.1.1, but fails in 3.2 and 3.3.

If the existing unit test `test_config.test_serialization_strategy` is modified to include a third property called `c` of type `str`, it will fail to properly deserialize `c`. Here's what the modified test looks like in full:

```
def test_serialization_strategy():
    class TestSerializationStrategy(SerializationStrategy):
        def serialize(self, value):
            return [value]

        def deserialize(self, value):
            return value[0]

    @dataclass
    class DataClass(DataClassDictMixin):
        a: int
        b: str
        c: str

        class Config(BaseConfig):
            serialization_strategy = {
                int: TestSerializationStrategy(),
                str: {
                    "serialize": lambda v: [v],
                    "deserialize": lambda v: v[0],
                },
            }

    instance = DataClass(a=123, b="abc", c="abc")
    assert DataClass.from_dict({"a": [123], "b": ["abc"], "c": ["abc"]}) == instance
    assert instance.to_dict() == {"a": [123], "b": ["abc"], "c": ["abc"]}
```

It appears to fail because the custom serialize/deserialize methods are called for b, but not for c.

```AssertionError: assert test_serialization_strategy.<locals>.DataClass(a=123, b='abc', c=['abc']) == test_serialization_strategy.<locals>.DataClass(a=123, b='abc', c='abc')```

Discussion:

Patch:
diff --git a/mashumaro/core/meta/code/builder.py b/mashumaro/core/meta/code/builder.py
index 453da7f..be2b69a 100644
--- a/mashumaro/core/meta/code/builder.py
+++ b/mashumaro/core/meta/code/builder.py
@@ -899,7 +899,6 @@ class CodeBuilder:
         yield metadata.get("serialization_strategy")
         yield from self.__iter_serialization_strategies(ftype)
 
-    @lru_cache()
     @typing.no_type_check
     def __iter_serialization_strategies(
         self, ftype: typing.Type


Test patch:
diff --git a/tests/test_config.py b/tests/test_config.py
index 17f0abb..c7ffa68 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -142,6 +142,7 @@ def test_serialization_strategy():
     class DataClass(DataClassDictMixin):
         a: int
         b: str
+        c: int
 
         class Config(BaseConfig):
             serialization_strategy = {
@@ -152,9 +153,9 @@ def test_serialization_strategy():
                 },
             }
 
-    instance = DataClass(a=123, b="abc")
-    assert DataClass.from_dict({"a": [123], "b": ["abc"]}) == instance
-    assert instance.to_dict() == {"a": [123], "b": ["abc"]}
+    instance = DataClass(a=123, b="abc", c=123)
+    assert DataClass.from_dict({"a": [123], "b": ["abc"], "c": [123]}) == instance
+    assert instance.to_dict() == {"a": [123], "b": ["abc"], "c": [123]}
 
 
 def test_named_tuple_as_dict():