Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into computed-field-ser-func
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhly committed Oct 25, 2023
2 parents 144120f + 23d1065 commit a4f0ca1
Show file tree
Hide file tree
Showing 43 changed files with 233 additions and 151 deletions.
117 changes: 64 additions & 53 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pydantic-core"
version = "2.10.1"
version = "2.11.0"
edition = "2021"
license = "MIT"
homepage = "https://github.com/pydantic/pydantic-core"
Expand All @@ -26,23 +26,23 @@ include = [
]

[dependencies]
pyo3 = { version = "0.19.2", features = ["generate-import-lib", "num-bigint"] }
regex = "1.9.6"
pyo3 = { version = "0.20.0", features = ["generate-import-lib", "num-bigint"] }
regex = "1.10.2"
strum = { version = "0.25.0", features = ["derive"] }
strum_macros = "0.25.2"
strum_macros = "0.25.3"
serde_json = {version = "1.0.107", features = ["arbitrary_precision", "preserve_order"]}
enum_dispatch = "0.3.8"
serde = { version = "1.0.188", features = ["derive"] }
serde = { version = "1.0.189", features = ["derive"] }
speedate = "0.12.0"
smallvec = "1.11.1"
ahash = "0.8.0"
ahash = "0.8.4"
url = "2.4.1"
# idna is already required by url, added here to be explicit
idna = "0.4.0"
base64 = "0.21.4"
base64 = "0.21.5"
num-bigint = "0.4.4"
python3-dll-a = "0.2.7"
uuid = "1.4.1"
uuid = "1.5.0"

[lib]
name = "_pydantic_core"
Expand All @@ -62,9 +62,9 @@ debug = true
strip = false

[dev-dependencies]
pyo3 = { version= "0.19.2", features = ["auto-initialize"] }
pyo3 = { version = "0.20.0", features = ["auto-initialize"] }

[build-dependencies]
version_check = "0.9.4"
# used where logic has to be version/distribution specific, e.g. pypy
pyo3-build-config = { version = "0.19.2" }
pyo3-build-config = { version = "0.20.0" }
2 changes: 1 addition & 1 deletion python/pydantic_core/core_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class CoreConfig(TypedDict, total=False):
allow_inf_nan: bool # default: True
# the config options are used to customise serialization to JSON
ser_json_timedelta: Literal['iso8601', 'float'] # default: 'iso8601'
ser_json_bytes: Literal['utf8', 'base64'] # default: 'utf8'
ser_json_bytes: Literal['utf8', 'base64', 'hex'] # default: 'utf8'
# used to hide input data from ValidationError repr
hide_input_in_errors: bool
validation_error_cause: bool # default: False
Expand Down
2 changes: 1 addition & 1 deletion src/errors/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn field_from_context<'py, T: FromPyObject<'py>>(
) -> PyResult<T> {
context
.ok_or_else(|| py_error_type!(PyTypeError; "{}: '{}' required in context", enum_name, field_name))?
.get_item(field_name)
.get_item(field_name)?
.ok_or_else(|| py_error_type!(PyTypeError; "{}: '{}' required in context", enum_name, field_name))?
.extract::<T>()
.map_err(|_| py_error_type!(PyTypeError; "{}: '{}' context value must be a {}", enum_name, field_name, type_name_fn()))
Expand Down
8 changes: 4 additions & 4 deletions src/errors/validation_exception.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use std::str::from_utf8;

use pyo3::exceptions::{PyKeyError, PyTypeError, PyValueError};
use pyo3::ffi;
use pyo3::intern;
use pyo3::once_cell::GILOnceCell;
use pyo3::prelude::*;
use pyo3::types::{PyDict, PyList, PyString};
use pyo3::{intern, AsPyPointer};
use serde::ser::{Error, SerializeMap, SerializeSeq};
use serde::{Serialize, Serializer};

Expand Down Expand Up @@ -445,7 +445,7 @@ impl TryFrom<&PyAny> for PyLineError {
let py = value.py();

let type_raw = dict
.get_item(intern!(py, "type"))
.get_item(intern!(py, "type"))?
.ok_or_else(|| PyKeyError::new_err("type"))?;

let error_type = if let Ok(type_str) = type_raw.downcast::<PyString>() {
Expand All @@ -459,9 +459,9 @@ impl TryFrom<&PyAny> for PyLineError {
));
};

let location = Location::try_from(dict.get_item("loc"))?;
let location = Location::try_from(dict.get_item("loc")?)?;

let input_value = match dict.get_item("input") {
let input_value = match dict.get_item("input")? {
Some(i) => i.into_py(py),
None => py.None(),
};
Expand Down
Loading

0 comments on commit a4f0ca1

Please sign in to comment.