Skip to content

Commit 1a94a86

Browse files
committed
more PyO3 0.21 changes
1 parent 82c0873 commit 1a94a86

File tree

11 files changed

+14
-13
lines changed

11 files changed

+14
-13
lines changed

src/errors/location.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use pyo3::exceptions::PyTypeError;
2-
use pyo3::once_cell::GILOnceCell;
2+
use pyo3::sync::GILOnceCell;
33
use std::fmt;
44

55
use pyo3::prelude::*;

src/errors/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use std::borrow::Cow;
33
use std::fmt;
44

55
use pyo3::exceptions::{PyKeyError, PyTypeError};
6-
use pyo3::once_cell::GILOnceCell;
76
use pyo3::prelude::*;
7+
use pyo3::sync::GILOnceCell;
88
use pyo3::types::{PyDict, PyList};
99

1010
use ahash::AHashMap;

src/errors/validation_exception.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use std::str::from_utf8;
55
use pyo3::exceptions::{PyKeyError, PyTypeError, PyValueError};
66
use pyo3::ffi;
77
use pyo3::intern;
8-
use pyo3::once_cell::GILOnceCell;
98
use pyo3::prelude::*;
9+
use pyo3::sync::GILOnceCell;
1010
use pyo3::types::{PyDict, PyList, PyString};
1111
use serde::ser::{Error, SerializeMap, SerializeSeq};
1212
use serde::{Serialize, Serializer};

src/input/input_python.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ fn maybe_as_enum(v: &PyAny) -> Option<&PyAny> {
773773
}
774774

775775
#[cfg(PyPy)]
776-
static DICT_KEYS_TYPE: pyo3::once_cell::GILOnceCell<Py<PyType>> = pyo3::once_cell::GILOnceCell::new();
776+
static DICT_KEYS_TYPE: pyo3::sync::GILOnceCell<Py<PyType>> = pyo3::sync::GILOnceCell::new();
777777

778778
#[cfg(PyPy)]
779779
fn is_dict_keys_type(v: &PyAny) -> bool {
@@ -791,7 +791,7 @@ fn is_dict_keys_type(v: &PyAny) -> bool {
791791
}
792792

793793
#[cfg(PyPy)]
794-
static DICT_VALUES_TYPE: pyo3::once_cell::GILOnceCell<Py<PyType>> = pyo3::once_cell::GILOnceCell::new();
794+
static DICT_VALUES_TYPE: pyo3::sync::GILOnceCell<Py<PyType>> = pyo3::sync::GILOnceCell::new();
795795

796796
#[cfg(PyPy)]
797797
fn is_dict_values_type(v: &PyAny) -> bool {
@@ -809,7 +809,7 @@ fn is_dict_values_type(v: &PyAny) -> bool {
809809
}
810810

811811
#[cfg(PyPy)]
812-
static DICT_ITEMS_TYPE: pyo3::once_cell::GILOnceCell<Py<PyType>> = pyo3::once_cell::GILOnceCell::new();
812+
static DICT_ITEMS_TYPE: pyo3::sync::GILOnceCell<Py<PyType>> = pyo3::sync::GILOnceCell::new();
813813

814814
#[cfg(PyPy)]
815815
fn is_dict_items_type(v: &PyAny) -> bool {

src/serializers/filter.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use ahash::AHashSet;
22
use pyo3::exceptions::PyValueError;
3+
use pyo3::types::PyEllipsis;
34
use std::hash::Hash;
45

56
use pyo3::exceptions::PyTypeError;
@@ -316,7 +317,7 @@ where
316317

317318
/// detect both ellipsis and `True` to be compatible with pydantic V1
318319
fn is_ellipsis_like(v: &PyAny) -> bool {
319-
v.is_ellipsis()
320+
v.is_instance_of::<PyEllipsis>()
320321
|| match v.downcast::<PyBool>() {
321322
Ok(b) => b.is_true(),
322323
Err(_) => false,

src/serializers/ob_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use pyo3::once_cell::GILOnceCell;
21
use pyo3::prelude::*;
2+
use pyo3::sync::GILOnceCell;
33
use pyo3::types::{
44
PyBool, PyByteArray, PyBytes, PyDate, PyDateTime, PyDelta, PyDict, PyFloat, PyFrozenSet, PyInt, PyIterator, PyList,
55
PySet, PyString, PyTime, PyTuple, PyType,

src/serializers/shared.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use std::borrow::Cow;
22
use std::fmt::Debug;
33

44
use pyo3::exceptions::PyTypeError;
5-
use pyo3::once_cell::GILOnceCell;
65
use pyo3::prelude::*;
6+
use pyo3::sync::GILOnceCell;
77
use pyo3::types::{PyDict, PyString};
88
use pyo3::{intern, PyTraverseError, PyVisit};
99

src/url.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use std::hash::{Hash, Hasher};
55

66
use idna::punycode::decode_to_string;
77
use pyo3::exceptions::PyValueError;
8-
use pyo3::once_cell::GILOnceCell;
98
use pyo3::pyclass::CompareOp;
9+
use pyo3::sync::GILOnceCell;
1010
use pyo3::types::{PyDict, PyType};
1111
use pyo3::{intern, prelude::*};
1212
use url::Url;

src/validators/datetime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use pyo3::intern;
2-
use pyo3::once_cell::GILOnceCell;
32
use pyo3::prelude::*;
3+
use pyo3::sync::GILOnceCell;
44
use pyo3::types::{PyDateTime, PyDict, PyString};
55
use speedate::{DateTime, Time};
66
use std::cmp::Ordering;

src/validators/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use std::fmt::Debug;
33
use enum_dispatch::enum_dispatch;
44

55
use pyo3::exceptions::PyTypeError;
6-
use pyo3::once_cell::GILOnceCell;
76
use pyo3::prelude::*;
7+
use pyo3::sync::GILOnceCell;
88
use pyo3::types::{PyAny, PyDict, PyTuple, PyType};
99
use pyo3::{intern, PyTraverseError, PyVisit};
1010

src/validators/with_default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use pyo3::intern;
2-
use pyo3::once_cell::GILOnceCell;
32
use pyo3::prelude::*;
3+
use pyo3::sync::GILOnceCell;
44
use pyo3::types::PyDict;
55
use pyo3::PyTraverseError;
66
use pyo3::PyVisit;

0 commit comments

Comments
 (0)