Repository: Fatal1ty/mashumaro (language: python)

Issue:
Annotated SerializationStrategy used as a field serialization strategy leads to RecursionError
* mashumaro version: 3.12
* Python version: 3.12.2
* Operating System: macOS 14.4

### Description

Minimap reproducible example:

```python
from typing import Any

from dataclasses import dataclass, field
from mashumaro import DataClassDictMixin, field_options
from mashumaro.types import SerializationStrategy


class MySerializationStrategy(SerializationStrategy, use_annotations=True):
    def serialize(self, value: Any) -> Any:
        return value

    def deserialize(self, value: Any) -> Any:
        return value


@dataclass
class MyClass(DataClassDictMixin):
    x: int = field(
        metadata=field_options(
            serialization_strategy=MySerializationStrategy()
        )
    )
```


Discussion / hints:

Fix patch:
diff --git a/mashumaro/core/meta/types/pack.py b/mashumaro/core/meta/types/pack.py
index f03181dd..e8b46371 100644
--- a/mashumaro/core/meta/types/pack.py
+++ b/mashumaro/core/meta/types/pack.py
@@ -110,6 +110,19 @@ def _pack_with_annotated_serialization_strategy(
     )
     overridden_fn = f"__{spec.field_ctx.name}_serialize_{random_hex()}"
     setattr(spec.attrs, overridden_fn, strategy.serialize)
+    new_spec = spec.copy(
+        type=value_type,
+        expression=(
+            f"{spec.self_attrs_name}.{overridden_fn}({spec.expression})"
+        ),
+    )
+    field_metadata = new_spec.field_ctx.metadata
+    if field_metadata.get("serialization_strategy") is strategy:
+        new_spec.field_ctx.metadata = {
+            k: v
+            for k, v in field_metadata.items()
+            if k != "serialization_strategy"
+        }
     return PackerRegistry.get(
         spec.copy(
             type=value_type,
diff --git a/mashumaro/core/meta/types/unpack.py b/mashumaro/core/meta/types/unpack.py
index 62c11829..78e14b6f 100644
--- a/mashumaro/core/meta/types/unpack.py
+++ b/mashumaro/core/meta/types/unpack.py
@@ -524,7 +524,15 @@ def _unpack_with_annotated_serialization_strategy(
     )
     overridden_fn = f"__{spec.field_ctx.name}_deserialize_{random_hex()}"
     setattr(spec.attrs, overridden_fn, strategy.deserialize)
-    unpacker = UnpackerRegistry.get(spec.copy(type=value_type))
+    new_spec = spec.copy(type=value_type)
+    field_metadata = new_spec.field_ctx.metadata
+    if field_metadata.get("serialization_strategy") is strategy:
+        new_spec.field_ctx.metadata = {
+            k: v
+            for k, v in field_metadata.items()
+            if k != "serialization_strategy"
+        }
+    unpacker = UnpackerRegistry.get(new_spec)
     return f"{spec.cls_attrs_name}.{overridden_fn}({unpacker})"
 
 


Test patch:
diff --git a/tests/test_serialization_strategy.py b/tests/test_serialization_strategy.py
index ba7958dc..3350333f 100644
--- a/tests/test_serialization_strategy.py
+++ b/tests/test_serialization_strategy.py
@@ -1,8 +1,8 @@
-from dataclasses import dataclass
+from dataclasses import dataclass, field
 from datetime import date
 from typing import Generic, List, Sequence, TypeVar
 
-from mashumaro import DataClassDictMixin
+from mashumaro import DataClassDictMixin, field_options
 from mashumaro.types import SerializationStrategy
 
 T = TypeVar("T")
@@ -153,3 +153,31 @@ class Config:
     assert MyDataClass.from_dict(
         {"x": ["2023-02-12", "2023-02-12", "2023-02-12", "2023-02-12"]}
     ) == MyDataClass(["2023-02-12", "2023-02-12", "2023-02-12"])
+
+
+def test_date_list_field_serialization_strategy_with_use_annotations():
+    @dataclass
+    class MyDataClass(DataClassDictMixin):
+        x: List[date] = field(
+            metadata=field_options(
+                serialization_strategy=(
+                    TruncatedAnnotatedDateListSerializationStrategy()
+                )
+            )
+        )
+
+    obj = MyDataClass(
+        [
+            date(2023, 2, 12),
+            date(2023, 2, 12),
+            date(2023, 2, 12),
+            date(2023, 2, 12),
+            date(2023, 2, 12),
+        ]
+    )
+    assert obj.to_dict() == {
+        "x": ["2023-02-12", "2023-02-12", "2023-02-12", "2023-02-12"]
+    }
+    assert MyDataClass.from_dict(
+        {"x": ["2023-02-12", "2023-02-12", "2023-02-12", "2023-02-12"]}
+    ) == MyDataClass([date(2023, 2, 12), date(2023, 2, 12), date(2023, 2, 12)])