@@ -6,7 +6,7 @@ use std::borrow::Cow;
66
77use crate :: build_tools:: py_schema_err;
88use crate :: definitions:: DefinitionsBuilder ;
9- use crate :: tools:: SchemaDict ;
9+ use crate :: tools:: { SchemaDict , UNION_ERR_SMALLVEC_CAPACITY } ;
1010use crate :: PydanticSerializationUnexpectedValue ;
1111
1212use super :: {
@@ -79,7 +79,7 @@ impl TypeSerializer for UnionSerializer {
7979 // try the serializers in left to right order with error_on fallback=true
8080 let mut new_extra = extra. clone ( ) ;
8181 new_extra. check = SerCheck :: Strict ;
82- let mut errors: SmallVec < [ PyErr ; 16 ] > = SmallVec :: new ( ) ;
82+ let mut errors: SmallVec < [ PyErr ; UNION_ERR_SMALLVEC_CAPACITY ] > = SmallVec :: new ( ) ;
8383
8484 for comb_serializer in & self . choices {
8585 match comb_serializer. to_python ( value, include, exclude, & new_extra) {
@@ -114,7 +114,7 @@ impl TypeSerializer for UnionSerializer {
114114 fn json_key < ' a > ( & self , key : & ' a Bound < ' _ , PyAny > , extra : & Extra ) -> PyResult < Cow < ' a , str > > {
115115 let mut new_extra = extra. clone ( ) ;
116116 new_extra. check = SerCheck :: Strict ;
117- let mut errors: SmallVec < [ PyErr ; 16 ] > = SmallVec :: new ( ) ;
117+ let mut errors: SmallVec < [ PyErr ; UNION_ERR_SMALLVEC_CAPACITY ] > = SmallVec :: new ( ) ;
118118
119119 for comb_serializer in & self . choices {
120120 match comb_serializer. json_key ( key, & new_extra) {
@@ -157,7 +157,7 @@ impl TypeSerializer for UnionSerializer {
157157 let py = value. py ( ) ;
158158 let mut new_extra = extra. clone ( ) ;
159159 new_extra. check = SerCheck :: Strict ;
160- let mut errors: SmallVec < [ PyErr ; 16 ] > = SmallVec :: new ( ) ;
160+ let mut errors: SmallVec < [ PyErr ; UNION_ERR_SMALLVEC_CAPACITY ] > = SmallVec :: new ( ) ;
161161
162162 for comb_serializer in & self . choices {
163163 match comb_serializer. to_python ( value, include, exclude, & new_extra) {
0 commit comments