Skip to content

Commit

Permalink
chore: bump pyo3 from 0.22.6 to 0.23.3
Browse files Browse the repository at this point in the history
  • Loading branch information
benfdking authored Dec 9, 2024
1 parent 5429de4 commit 01c4b15
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ serde_yaml = { version = "0.9.34", optional = true }
append-only-vec = "0.1.5"

# Only activated on python
pyo3 = { version = "0.22.4", features = ["auto-initialize"], optional = true }
pyo3 = { version = "0.23.3", features = ["auto-initialize"], optional = true }

[target.'cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), target_os = "unknown"))'.dependencies]
getrandom = { version = "0.2", features = ["js"] }
Expand Down
6 changes: 4 additions & 2 deletions crates/lib/src/templaters/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use pyo3::types::{PyDict, PySlice};
use pyo3::{Py, PyAny, Python};
use sqruff_lib_core::errors::SQLFluffUserError;
use sqruff_lib_core::templaters::base::{RawFileSlice, TemplatedFile, TemplatedFileSlice};
use std::ffi::CString;

use crate::cli::formatters::Formatter;
use crate::core::config::FluffConfig;
Expand Down Expand Up @@ -87,12 +88,13 @@ At the moment, dot notation is not supported in the templater."

// Need to pull context out of config
let templated_file = Python::with_gil(|py| -> PyResult<TemplatedFile> {
let fun: Py<PyAny> = PyModule::from_code_bound(py, PYTHON_FILE, "", "")?
let file = CString::new(PYTHON_FILE).unwrap();
let fun: Py<PyAny> = PyModule::from_code(py, &file, c"", c"")?
.getattr("process_from_rust")?
.into();

// pass object with Rust tuple of positional arguments
let py_dict = PyDict::new_bound(py);
let py_dict = PyDict::new(py);
for (k, v) in hashmap.unwrap() {
py_dict.set_item(k, v)?;
}
Expand Down

0 comments on commit 01c4b15

Please sign in to comment.