@@ -6,7 +6,7 @@ use std::borrow::Cow;
6
6
7
7
use crate :: build_tools:: py_schema_err;
8
8
use crate :: definitions:: DefinitionsBuilder ;
9
- use crate :: tools:: SchemaDict ;
9
+ use crate :: tools:: { SchemaDict , UNION_ERR_SMALLVEC_CAPACITY } ;
10
10
use crate :: PydanticSerializationUnexpectedValue ;
11
11
12
12
use super :: {
@@ -79,7 +79,7 @@ impl TypeSerializer for UnionSerializer {
79
79
// try the serializers in left to right order with error_on fallback=true
80
80
let mut new_extra = extra. clone ( ) ;
81
81
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 ( ) ;
83
83
84
84
for comb_serializer in & self . choices {
85
85
match comb_serializer. to_python ( value, include, exclude, & new_extra) {
@@ -114,7 +114,7 @@ impl TypeSerializer for UnionSerializer {
114
114
fn json_key < ' a > ( & self , key : & ' a Bound < ' _ , PyAny > , extra : & Extra ) -> PyResult < Cow < ' a , str > > {
115
115
let mut new_extra = extra. clone ( ) ;
116
116
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 ( ) ;
118
118
119
119
for comb_serializer in & self . choices {
120
120
match comb_serializer. json_key ( key, & new_extra) {
@@ -157,7 +157,7 @@ impl TypeSerializer for UnionSerializer {
157
157
let py = value. py ( ) ;
158
158
let mut new_extra = extra. clone ( ) ;
159
159
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 ( ) ;
161
161
162
162
for comb_serializer in & self . choices {
163
163
match comb_serializer. to_python ( value, include, exclude, & new_extra) {
0 commit comments