Skip to content

Commit a809a34

Browse files
committed
Continue implementing new realization. Implementing Cursor. pre-commit disabled.
Signed-off-by: chandr-andr (Kiselev Aleksandr) <chandr@chandr.net>
1 parent 7c03935 commit a809a34

File tree

7 files changed

+39
-529
lines changed

7 files changed

+39
-529
lines changed

external_crates/pyo3-asyncio/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![warn(missing_docs)]
22
#![allow(clippy::borrow_deref_ref)]
3+
#![allow(warnings)]
34

45
//! Rust Bindings to the Python Asyncio Event Loop
56
//!

src/common.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
use deadpool_postgres::Object;
2-
use pyo3::{types::PyModule, PyAny, PyResult, Python};
2+
use pyo3::{
3+
types::{PyAnyMethods, PyModule, PyModuleMethods},
4+
Bound, PyAny, PyResult, Python,
5+
};
36

47
use crate::{
58
driver::transaction_options::{IsolationLevel, ReadVariant},
@@ -18,14 +21,14 @@ use crate::{
1821
/// May return Err Result if can't build module or change modules.
1922
pub fn add_module(
2023
py: Python<'_>,
21-
parent_mod: &PyModule,
24+
parent_mod: &Bound<'_, PyModule>,
2225
child_mod_name: &'static str,
23-
child_mod_builder: impl FnOnce(Python<'_>, &PyModule) -> PyResult<()>,
26+
child_mod_builder: impl FnOnce(Python<'_>, &Bound<'_, PyModule>) -> PyResult<()>,
2427
) -> PyResult<()> {
25-
let sub_module = PyModule::new(py, child_mod_name)?;
26-
child_mod_builder(py, sub_module)?;
27-
parent_mod.add_submodule(sub_module)?;
28-
py.import("sys")?.getattr("modules")?.set_item(
28+
let sub_module = PyModule::new_bound(py, child_mod_name)?;
29+
child_mod_builder(py, &sub_module)?;
30+
parent_mod.add_submodule(&sub_module)?;
31+
py.import_bound("sys")?.getattr("modules")?.set_item(
2932
format!("{}.{}", parent_mod.name()?, child_mod_name),
3033
sub_module,
3134
)?;

0 commit comments

Comments
 (0)