Skip to content

Commit 4a8aa3e

Browse files
committed
try moving import
1 parent 0c07f9a commit 4a8aa3e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/validators/model_fields.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ impl Validator for ModelFieldsValidator {
125125
// this validator does not yet support partial validation, disable it to avoid incorrect results
126126
state.allow_partial = false.into();
127127

128-
let deprecation_warning_type = py.import_bound("builtins")?.getattr("DeprecationWarning")?;
129-
130128
let strict = state.strict_or(self.strict);
131129
let from_attributes = state.extra().from_attributes.unwrap_or(self.from_attributes);
132130

@@ -189,6 +187,7 @@ impl Validator for ModelFieldsValidator {
189187
used_keys.insert(lookup_path.first_key());
190188
}
191189
if let Some(msg) = &field.deprecation_msg {
190+
let deprecation_warning_type = py.import_bound("builtins")?.getattr("DeprecationWarning")?;
192191
PyErr::warn_bound(py, &deprecation_warning_type, msg, 2)?;
193192
}
194193
match field.validator.validate(py, value.borrow_input(), state) {

0 commit comments

Comments
 (0)