File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -401,15 +401,16 @@ def from_payloads(
401401 ) from err
402402 return values
403403
404- def with_context (self , context : SerializationContext ) -> Self :
404+ def with_context (self , context : SerializationContext ) -> CompositePayloadConverter :
405405 """Return a new instance with the given context."""
406- converters = [
407- c .with_context (context ) if isinstance (c , WithSerializationContext ) else c
408- for c in self .converters .values ()
409- ]
410- instance = type (self ).__new__ (type (self ))
411- CompositePayloadConverter .__init__ (instance , * converters )
412- return instance
406+ return CompositePayloadConverter (
407+ * (
408+ c .with_context (context )
409+ if isinstance (c , WithSerializationContext )
410+ else c
411+ for c in self .converters .values ()
412+ )
413+ )
413414
414415
415416class DefaultPayloadConverter (CompositePayloadConverter ):
You can’t perform that action at this time.
0 commit comments