Skip to content

Commit

Permalink
Fix typing for schema param of _bind_to_schema (#2724)
Browse files Browse the repository at this point in the history
  • Loading branch information
sloria authored Jan 4, 2025
1 parent 447eb86 commit 560eed7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/marshmallow/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def deserialize(

# Methods for concrete classes to override.

def _bind_to_schema(self, field_name: str, schema: Schema) -> None:
def _bind_to_schema(self, field_name: str, schema: Schema | Field) -> None:
"""Update field with values from its parent schema. Called by
:meth:`Schema._bind_field <marshmallow.Schema._bind_field>`.
Expand Down Expand Up @@ -767,7 +767,7 @@ def __init__(self, cls_or_instance: Field | type[Field], **kwargs):
self.only = self.inner.only
self.exclude = self.inner.exclude

def _bind_to_schema(self, field_name: str, schema: Schema) -> None:
def _bind_to_schema(self, field_name: str, schema: Schema | Field) -> None:
super()._bind_to_schema(field_name, schema)
self.inner = copy.deepcopy(self.inner)
self.inner._bind_to_schema(field_name, self)
Expand Down Expand Up @@ -841,7 +841,7 @@ def __init__(self, tuple_fields: typing.Iterable[Field], *args, **kwargs):

self.validate_length = Length(equal=len(self.tuple_fields))

def _bind_to_schema(self, field_name: str, schema: Schema) -> None:
def _bind_to_schema(self, field_name: str, schema: Schema | Field) -> None:
super()._bind_to_schema(field_name, schema)
new_tuple_fields = []
for field in self.tuple_fields:
Expand Down

0 comments on commit 560eed7

Please sign in to comment.