Skip to content

Commit 684315a

Browse files
authored
Merge pull request #30 from LilyFoote/upgrade-pyo3
Upgrade pyo3 to version 0.23.1
2 parents 0a16ea3 + 3a65e3d commit 684315a

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

Cargo.lock

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ crate-type = ["cdylib"]
1212
encoding_rs = "0.8.35"
1313
miette = { version = "7.2.0", features = ["fancy"] }
1414
num-bigint = "0.4.6"
15-
pyo3 = { version = "0.22.0", features = ["num-bigint"] }
15+
pyo3 = { version = "0.23.1", features = ["num-bigint"] }
1616
quickcheck = "1.0.3"
1717
sugar_path = "1.2.0"
1818
thiserror = "1.0.64"

src/loaders.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ mod tests {
343343

344344
fn matches(path: PathBuf, template_name: String) -> bool {
345345
Python::with_gil(|py| {
346-
let utils_os = PyModule::import_bound(py, "django.utils._os").unwrap();
346+
let utils_os = PyModule::import(py, "django.utils._os").unwrap();
347347
let django_safe_join = utils_os.getattr("safe_join").unwrap();
348348

349349
let joined = django_safe_join

src/render.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl Variable {
1717
let first = parts.next().expect("Variable names cannot be empty");
1818
let mut variable = match context.get(first) {
1919
Some(variable) => variable.clone(),
20-
None => PyString::new_bound(py, "").into_any(),
20+
None => PyString::new(py, "").into_any(),
2121
};
2222
for part in parts {
2323
variable = match variable.get_item(part) {

src/template.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,9 @@ mod tests {
273273
pyo3::prepare_freethreaded_python();
274274

275275
Python::with_gil(|py| {
276-
let template_string = PyString::new_bound(py, "");
276+
let template_string = PyString::new(py, "");
277277
let template = Template::from_string(template_string).unwrap();
278-
let context = PyDict::new_bound(py);
278+
let context = PyDict::new(py);
279279

280280
assert_eq!(template.render(py, Some(context), None).unwrap(), "");
281281
})
@@ -286,9 +286,9 @@ mod tests {
286286
pyo3::prepare_freethreaded_python();
287287

288288
Python::with_gil(|py| {
289-
let template_string = PyString::new_bound(py, "Hello {{ user }}!");
289+
let template_string = PyString::new(py, "Hello {{ user }}!");
290290
let template = Template::from_string(template_string).unwrap();
291-
let context = PyDict::new_bound(py);
291+
let context = PyDict::new(py);
292292
context.set_item("user", "Lily").unwrap();
293293

294294
assert_eq!(
@@ -303,9 +303,9 @@ mod tests {
303303
pyo3::prepare_freethreaded_python();
304304

305305
Python::with_gil(|py| {
306-
let template_string = PyString::new_bound(py, "Hello {{ user }}!");
306+
let template_string = PyString::new(py, "Hello {{ user }}!");
307307
let template = Template::from_string(template_string).unwrap();
308-
let context = PyDict::new_bound(py);
308+
let context = PyDict::new(py);
309309

310310
assert_eq!(template.render(py, Some(context), None).unwrap(), "Hello !");
311311
})
@@ -316,11 +316,11 @@ mod tests {
316316
pyo3::prepare_freethreaded_python();
317317

318318
Python::with_gil(|py| {
319-
let template_string = PyString::new_bound(py, "Hello {{ user.profile.names.0 }}!");
319+
let template_string = PyString::new(py, "Hello {{ user.profile.names.0 }}!");
320320
let template = Template::from_string(template_string).unwrap();
321-
let locals = PyDict::new_bound(py);
322-
py.run_bound(
323-
r#"
321+
let locals = PyDict::new(py);
322+
py.run(
323+
cr#"
324324
class User:
325325
def __init__(self, names):
326326
self.profile = {"names": names}
@@ -332,7 +332,7 @@ user = User(["Lily"])
332332
)
333333
.unwrap();
334334
let user = locals.get_item("user").unwrap().unwrap();
335-
let context = PyDict::new_bound(py);
335+
let context = PyDict::new(py);
336336
context.set_item("user", user.into_any()).unwrap();
337337

338338
assert_eq!(
@@ -361,9 +361,9 @@ user = User(["Lily"])
361361
false,
362362
)
363363
.unwrap();
364-
let template_string = PyString::new_bound(py, "Hello {{ user }}!");
364+
let template_string = PyString::new(py, "Hello {{ user }}!");
365365
let template = engine.from_string(template_string).unwrap();
366-
let context = PyDict::new_bound(py);
366+
let context = PyDict::new(py);
367367

368368
assert_eq!(template.render(py, Some(context), None).unwrap(), "Hello !");
369369
})

0 commit comments

Comments
 (0)