Skip to content

Commit 8d78add

Browse files
MartinSahlenMartin Abelson Sahlen
andauthored
Chore: bump PYO3 to v"0.22.6" (#4400)
Co-authored-by: Martin Abelson Sahlen <[email protected]>
1 parent 160e688 commit 8d78add

File tree

3 files changed

+35
-144
lines changed

3 files changed

+35
-144
lines changed

sqlglotrs/Cargo.lock

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

sqlglotrs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ name = "sqlglotrs"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]
12-
pyo3 = "0.20.0"
12+
pyo3 = "0.22.6"

sqlglotrs/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ impl Token {
4343
) -> Token {
4444
Python::with_gil(|py| Token {
4545
token_type,
46-
token_type_py: PyNone::get(py).into(),
47-
text: PyString::new(py, &text).into(),
46+
token_type_py: PyNone::get_bound(py).into_py(py),
47+
text: PyString::new_bound(py, &text).into_py(py),
4848
line,
4949
col,
5050
start,
5151
end,
52-
comments: PyList::new(py, &comments).into(),
52+
comments: PyList::new_bound(py, &comments).into(),
5353
})
5454
}
5555

5656
pub fn append_comments(&self, comments: &mut Vec<String>) {
5757
Python::with_gil(|py| {
58-
let pylist = self.comments.as_ref(py);
58+
let pylist = self.comments.bind(py);
5959
for comment in comments.iter() {
6060
if let Err(_) = pylist.append(comment) {
6161
panic!("Failed to append comments to the Python list");
@@ -74,20 +74,20 @@ impl Token {
7474
Python::with_gil(|py| {
7575
Ok(format!(
7676
"<Token token_type: {}, text: {}, line: {}, col: {}, start: {}, end: {}, comments: {}>",
77-
self.token_type_py.as_ref(py).repr()?,
78-
self.text.as_ref(py).repr()?,
77+
self.token_type_py.bind(py).repr()?,
78+
self.text.bind(py).repr()?,
7979
self.line,
8080
self.col,
8181
self.start,
8282
self.end,
83-
self.comments.as_ref(py).repr()?,
83+
self.comments.bind(py).repr()?,
8484
))
8585
})
8686
}
8787
}
8888

8989
#[pymodule]
90-
fn sqlglotrs(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
90+
fn sqlglotrs(m: &Bound<'_, PyModule>) -> PyResult<()> {
9191
m.add_class::<Token>()?;
9292
m.add_class::<TokenTypeSettings>()?;
9393
m.add_class::<TokenizerSettings>()?;

0 commit comments

Comments
 (0)