File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 11use std:: fmt;
22use std:: sync:: Mutex ;
33
4- use pyo3:: exceptions:: { PyTypeError , PyValueError } ;
5- use pyo3:: intern;
4+ use pyo3:: exceptions:: { PyTypeError , PyUserWarning , PyValueError } ;
65use pyo3:: prelude:: * ;
76use pyo3:: types:: { PyBool , PyString } ;
7+ use pyo3:: { intern, PyTypeInfo } ;
88
99use serde:: ser:: Error ;
1010
@@ -471,7 +471,7 @@ impl CollectWarnings {
471471
472472 let message = format ! ( "Pydantic serializer warnings:\n {}" , warnings. join( "\n " ) ) ;
473473 if self . mode == WarningsMode :: Warn {
474- let user_warning_type = py . import_bound ( "builtins" ) ? . getattr ( "UserWarning" ) ? ;
474+ let user_warning_type = PyUserWarning :: type_object ( py ) ;
475475 PyErr :: warn_bound ( py, & user_warning_type, & message, 0 )
476476 } else {
477477 Err ( PydanticSerializationError :: new_err ( message) )
You can’t perform that action at this time.
0 commit comments