@@ -8,15 +8,14 @@ use test::{black_box, Bencher};
88use pyo3:: prelude:: * ;
99use pyo3:: types:: { PyDict , PyString } ;
1010
11- use _pydantic_core:: { validate_core_schema , SchemaValidator } ;
11+ use _pydantic_core:: SchemaValidator ;
1212
1313fn build_schema_validator_with_globals (
1414 py : Python ,
1515 code : & CStr ,
1616 globals : Option < & Bound < ' _ , PyDict > > ,
1717) -> SchemaValidator {
18- let mut schema = py. eval ( code, globals, None ) . unwrap ( ) . extract ( ) . unwrap ( ) ;
19- schema = validate_core_schema ( & schema, None ) . unwrap ( ) . extract ( ) . unwrap ( ) ;
18+ let schema = py. eval ( code, globals, None ) . unwrap ( ) . extract ( ) . unwrap ( ) ;
2019 SchemaValidator :: py_new ( py, & schema, None ) . unwrap ( )
2120}
2221
@@ -510,8 +509,7 @@ fn complete_model(bench: &mut Bencher) {
510509 sys_path. call_method1 ( "append" , ( "./tests/benchmarks/" , ) ) . unwrap ( ) ;
511510
512511 let complete_schema = py. import ( "complete_schema" ) . unwrap ( ) ;
513- let mut schema = complete_schema. call_method0 ( "schema" ) . unwrap ( ) ;
514- schema = validate_core_schema ( & schema, None ) . unwrap ( ) . extract ( ) . unwrap ( ) ;
512+ let schema = complete_schema. call_method0 ( "schema" ) . unwrap ( ) ;
515513 let validator = SchemaValidator :: py_new ( py, & schema, None ) . unwrap ( ) ;
516514
517515 let input = complete_schema. call_method0 ( "input_data_lax" ) . unwrap ( ) ;
@@ -534,8 +532,7 @@ fn nested_model_using_definitions(bench: &mut Bencher) {
534532 sys_path. call_method1 ( "append" , ( "./tests/benchmarks/" , ) ) . unwrap ( ) ;
535533
536534 let complete_schema = py. import ( "nested_schema" ) . unwrap ( ) ;
537- let mut schema = complete_schema. call_method0 ( "schema_using_defs" ) . unwrap ( ) ;
538- schema = validate_core_schema ( & schema, None ) . unwrap ( ) . extract ( ) . unwrap ( ) ;
535+ let schema = complete_schema. call_method0 ( "schema_using_defs" ) . unwrap ( ) ;
539536 let validator = SchemaValidator :: py_new ( py, & schema, None ) . unwrap ( ) ;
540537
541538 let input = complete_schema. call_method0 ( "input_data_valid" ) . unwrap ( ) ;
@@ -562,8 +559,7 @@ fn nested_model_inlined(bench: &mut Bencher) {
562559 sys_path. call_method1 ( "append" , ( "./tests/benchmarks/" , ) ) . unwrap ( ) ;
563560
564561 let complete_schema = py. import ( "nested_schema" ) . unwrap ( ) ;
565- let mut schema = complete_schema. call_method0 ( "inlined_schema" ) . unwrap ( ) ;
566- schema = validate_core_schema ( & schema, None ) . unwrap ( ) . extract ( ) . unwrap ( ) ;
562+ let schema = complete_schema. call_method0 ( "inlined_schema" ) . unwrap ( ) ;
567563 let validator = SchemaValidator :: py_new ( py, & schema, None ) . unwrap ( ) ;
568564
569565 let input = complete_schema. call_method0 ( "input_data_valid" ) . unwrap ( ) ;
0 commit comments