Skip to content

Commit 918b487

Browse files
committed
fixes for py.None() change
1 parent 1083986 commit 918b487

File tree

11 files changed

+16
-16
lines changed

11 files changed

+16
-16
lines changed

src/argument_markers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl ArgsKwargs {
5050
Ok(b) => (!b).into_py(py),
5151
Err(e) => e.into_py(py),
5252
},
53-
_ => py.NotImplemented(),
53+
_ => py.NotImplemented().into(),
5454
}
5555
}
5656

src/errors/validation_exception.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,12 @@ impl ValidationError {
294294
// away safely.
295295
self.line_errors.iter().map(|e| -> PyObject {
296296
if iteration_error.is_some() {
297-
return py.None();
297+
return py.None().into();
298298
}
299299
e.as_dict(py, url_prefix, include_context, self.input_type, include_input)
300300
.unwrap_or_else(|err| {
301301
iteration_error = Some(err);
302-
py.None()
302+
py.None().into()
303303
})
304304
}),
305305
);
@@ -489,7 +489,7 @@ impl TryFrom<&PyAny> for PyLineError {
489489

490490
let input_value = match dict.get_item("input")? {
491491
Some(i) => i.into_py(py),
492-
None => py.None(),
492+
None => py.None().into(),
493493
};
494494

495495
Ok(Self {

src/input/datetime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ impl TzInfo {
530530

531531
fn fromutc<'py>(&self, dt: &'py PyDateTime) -> PyResult<&'py PyAny> {
532532
let py = dt.py();
533-
dt.call_method1("__add__", (self.utcoffset(py, py.None().as_ref(py))?,))
533+
dt.call_method1("__add__", (self.utcoffset(py, py.None())?,))
534534
}
535535

536536
fn __repr__(&self) -> String {

src/serializers/ob_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub enum IsType {
6262
impl ObTypeLookup {
6363
fn new(py: Python) -> Self {
6464
Self {
65-
none: py.None().as_ref(py).get_type_ptr() as usize,
65+
none: py.None().get_type_ptr() as usize,
6666
int: PyInt::type_object_raw(py) as usize,
6767
bool: PyBool::type_object_raw(py) as usize,
6868
float: PyFloat::type_object_raw(py) as usize,

src/url.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,8 @@ fn host_to_dict<'a>(py: Python<'a>, lib_url: &Url) -> PyResult<&'a PyDict> {
469469
dict.set_item(
470470
"username",
471471
match lib_url.username() {
472-
"" => py.None(),
473-
user => user.into_py(py),
472+
"" => py.None().into(),
473+
user => user.to_object(py),
474474
},
475475
)?;
476476
dict.set_item("password", lib_url.password())?;

src/validators/dataclass.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ impl Validator for DataclassArgsValidator {
398398
// which doesn't make much sense in this context but we need to put something there
399399
// so that function validators that sit between DataclassValidator and DataclassArgsValidator
400400
// always get called the same shape of data.
401-
Ok(PyTuple::new(py, vec![dict.to_object(py), py.None()]).into_py(py))
401+
Ok(PyTuple::new(py, vec![dict.to_object(py), py.None().into()]).into_py(py))
402402
};
403403

404404
if let Some(field) = self.fields.iter().find(|f| f.name == field_name) {

src/validators/function.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ macro_rules! impl_build {
6868
func: func_info.function,
6969
config: match config {
7070
Some(c) => c.into(),
71-
None => py.None(),
71+
None => py.None().into(),
7272
},
7373
name,
7474
field_name: func_info.field_name,
@@ -209,7 +209,7 @@ impl BuildValidator for FunctionPlainValidator {
209209
func: function_info.function.clone(),
210210
config: match config {
211211
Some(c) => c.into(),
212-
None => py.None(),
212+
None => py.None().into(),
213213
},
214214
name: format!(
215215
"function-plain[{}()]",
@@ -275,7 +275,7 @@ impl BuildValidator for FunctionWrapValidator {
275275
func: function_info.function.clone(),
276276
config: match config {
277277
Some(c) => c.into(),
278-
None => py.None(),
278+
None => py.None().into(),
279279
},
280280
name: format!("function-wrap[{}()]", function_name(function_info.function.as_ref(py))?),
281281
field_name: function_info.field_name.clone(),

src/validators/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ impl<'py> SelfValidator<'py> {
405405
Ok(SchemaValidator {
406406
validator,
407407
definitions,
408-
py_schema: py.None(),
408+
py_schema: py.None().into(),
409409
py_config: None,
410410
title: "Self Schema".into_py(py),
411411
hide_input_in_errors: false,

src/validators/model_fields.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ impl Validator for ModelFieldsValidator {
427427
new_data.update(non_extra_data.as_mapping())?;
428428
new_extra.to_object(py)
429429
}
430-
_ => py.None(),
430+
_ => py.None().into(),
431431
};
432432

433433
let fields_set: &PySet = PySet::new(py, &[field_name.to_string()])?;

src/validators/none.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl Validator for NoneValidator {
3131
_state: &mut ValidationState,
3232
) -> ValResult<PyObject> {
3333
match input.is_none() {
34-
true => Ok(py.None()),
34+
true => Ok(py.None().into()),
3535
false => Err(ValError::new(ErrorTypeDefaults::NoneRequired, input)),
3636
}
3737
}

src/validators/nullable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl Validator for NullableValidator {
4040
state: &mut ValidationState,
4141
) -> ValResult<PyObject> {
4242
match input.is_none() {
43-
true => Ok(py.None()),
43+
true => Ok(py.None().into()),
4444
false => self.validator.validate(py, input, state),
4545
}
4646
}

0 commit comments

Comments
 (0)