Skip to content

Commit 34d607d

Browse files
Bump pyo3 from 0.21.2 to 0.22.3 in the minor-patch-dependencies group (#99)
* Bump pyo3 from 0.21.2 to 0.22.3 in the minor-patch-dependencies group Bumps the minor-patch-dependencies group with 1 update: [pyo3](https://github.com/pyo3/pyo3). Updates `pyo3` from 0.21.2 to 0.22.3 - [Release notes](https://github.com/pyo3/pyo3/releases) - [Changelog](https://github.com/PyO3/pyo3/blob/v0.22.3/CHANGELOG.md) - [Commits](PyO3/pyo3@v0.21.2...v0.22.3) --- updated-dependencies: - dependency-name: pyo3 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: minor-patch-dependencies ... Signed-off-by: dependabot[bot] <support@github.com> * Use gil-refs feature explicitly * Remove deprecated as_ref(py) --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mathieu Leplatre <mathieu@mozilla.com>
1 parent 1bd7a3d commit 34d607d

File tree

4 files changed

+31
-134
lines changed

4 files changed

+31
-134
lines changed

Cargo.lock

Lines changed: 23 additions & 126 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ serde_json = "1.0"
1717
canonical_json = "0.5.0"
1818

1919
[dependencies.pyo3]
20-
version = "0.21.2"
21-
features = ["extension-module"]
20+
version = "0.22.3"
21+
features = ["extension-module", "gil-refs"]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["maturin>=0.14,<0.15"]
2+
requires = ["maturin>=1,<2"]
33
build-backend = "maturin"
44

55
[package.metadata.maturin]

src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl From<PyCanonicalJSONError> for pyo3::PyErr {
5757

5858
/// A canonical JSON serializer written in Rust
5959
#[pymodule]
60-
fn canonicaljson(_py: Python, m: &PyModule) -> PyResult<()> {
60+
fn canonicaljson(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
6161
m.add("__version__", env!("CARGO_PKG_VERSION"))?;
6262

6363
m.add_wrapped(wrap_pyfunction!(dump))?;
@@ -105,7 +105,7 @@ fn to_json(py: Python, obj: &PyObject) -> Result<serde_json::Value, PyCanonicalJ
105105
};
106106
}
107107

108-
if obj.as_ref(py).eq(&py.None())? {
108+
if obj.bind(py).eq(&py.None())? {
109109
return Ok(serde_json::Value::Null);
110110
}
111111

@@ -117,7 +117,7 @@ fn to_json(py: Python, obj: &PyObject) -> Result<serde_json::Value, PyCanonicalJ
117117
return_cast!(PyDict, |x: &PyDict| {
118118
let mut map = serde_json::Map::new();
119119
for (key_obj, value) in x.iter() {
120-
let key = if key_obj.eq(py.None().as_ref(py))? {
120+
let key = if key_obj.eq(py.None().bind(py))? {
121121
Ok("null".to_string())
122122
} else if let Ok(val) = key_obj.extract::<bool>() {
123123
Ok(if val {
@@ -131,7 +131,7 @@ fn to_json(py: Python, obj: &PyObject) -> Result<serde_json::Value, PyCanonicalJ
131131
Err(PyCanonicalJSONError::DictKeyNotSerializable {
132132
typename: key_obj
133133
.to_object(py)
134-
.as_ref(py)
134+
.bind(py)
135135
.get_type()
136136
.name()?
137137
.to_string(),
@@ -165,6 +165,6 @@ fn to_json(py: Python, obj: &PyObject) -> Result<serde_json::Value, PyCanonicalJ
165165

166166
// At this point we can't cast it, set up the error object
167167
Err(PyCanonicalJSONError::InvalidCast {
168-
typename: obj.as_ref(py).get_type().name()?.to_string(),
168+
typename: obj.bind(py).get_type().name()?.to_string(),
169169
})
170170
}

0 commit comments

Comments
 (0)