Skip to content

Commit

Permalink
Remove unused copies in CoreSchema walking (#7528)
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangb committed Sep 20, 2023
1 parent c5dce37 commit 56f41a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pydantic/_internal/_core_utils.py
Expand Up @@ -190,13 +190,13 @@ def _build_schema_type_to_method(self) -> dict[core_schema.CoreSchemaType, Recur
return mapping

def walk(self, schema: core_schema.CoreSchema, f: Walk) -> core_schema.CoreSchema:
return f(schema.copy(), self._walk)
return f(schema, self._walk)

def _walk(self, schema: core_schema.CoreSchema, f: Walk) -> core_schema.CoreSchema:
schema = self._schema_type_to_method[schema['type']](schema, f)
ser_schema: core_schema.SerSchema | None = schema.get('serialization') # type: ignore
if ser_schema:
schema['serialization'] = self._handle_ser_schemas(ser_schema.copy(), f)
schema['serialization'] = self._handle_ser_schemas(ser_schema, f)
return schema

def _handle_other_schemas(self, schema: core_schema.CoreSchema, f: Walk) -> core_schema.CoreSchema:
Expand Down

0 comments on commit 56f41a4

Please sign in to comment.