Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14864787
D16523.id48830.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
21 KB
Subscribers
None
D16523.id48830.diff
View Options
diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -55,7 +55,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.58",
+ "syn 2.0.72",
]
[[package]]
@@ -176,7 +176,7 @@
"regex",
"rustc-hash",
"shlex",
- "syn 2.0.58",
+ "syn 2.0.72",
]
[[package]]
@@ -529,7 +529,7 @@
"proc-macro2",
"quote",
"scratch",
- "syn 2.0.58",
+ "syn 2.0.72",
]
[[package]]
@@ -546,7 +546,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.58",
+ "syn 2.0.72",
]
[[package]]
@@ -710,7 +710,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.58",
+ "syn 2.0.72",
]
[[package]]
@@ -811,6 +811,12 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
+[[package]]
+name = "heck"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
+
[[package]]
name = "hermit-abi"
version = "0.3.9"
@@ -1162,29 +1168,6 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
-[[package]]
-name = "parking_lot"
-version = "0.12.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
-dependencies = [
- "lock_api",
- "parking_lot_core",
-]
-
-[[package]]
-name = "parking_lot_core"
-version = "0.9.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
-dependencies = [
- "cfg-if",
- "libc",
- "redox_syscall",
- "smallvec",
- "windows-targets 0.48.5",
-]
-
[[package]]
name = "peeking_take_while"
version = "0.1.2"
@@ -1224,7 +1207,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.58",
+ "syn 2.0.72",
]
[[package]]
@@ -1296,14 +1279,14 @@
checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7"
dependencies = [
"proc-macro2",
- "syn 2.0.58",
+ "syn 2.0.72",
]
[[package]]
name = "proc-macro2"
-version = "1.0.79"
+version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
+checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
dependencies = [
"unicode-ident",
]
@@ -1325,7 +1308,7 @@
checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270"
dependencies = [
"bytes",
- "heck",
+ "heck 0.4.1",
"itertools 0.10.5",
"lazy_static",
"log",
@@ -1364,15 +1347,15 @@
[[package]]
name = "pyo3"
-version = "0.20.3"
+version = "0.22.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "53bdbb96d49157e65d45cc287af5f32ffadd5f4761438b527b055fb0d4bb8233"
+checksum = "831e8e819a138c36e212f3af3fd9eeffed6bf1510a805af35b0edee5ffa59433"
dependencies = [
"cfg-if",
"indoc",
"libc",
"memoffset",
- "parking_lot",
+ "once_cell",
"portable-atomic",
"pyo3-build-config",
"pyo3-ffi",
@@ -1382,9 +1365,9 @@
[[package]]
name = "pyo3-build-config"
-version = "0.20.3"
+version = "0.22.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "deaa5745de3f5231ce10517a1f5dd97d53e5a2fd77aa6b5842292085831d48d7"
+checksum = "1e8730e591b14492a8945cdff32f089250b05f5accecf74aeddf9e8272ce1fa8"
dependencies = [
"once_cell",
"target-lexicon",
@@ -1392,9 +1375,9 @@
[[package]]
name = "pyo3-ffi"
-version = "0.20.3"
+version = "0.22.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62b42531d03e08d4ef1f6e85a2ed422eb678b8cd62b762e53891c05faf0d4afa"
+checksum = "5e97e919d2df92eb88ca80a037969f44e5e70356559654962cbb3316d00300c6"
dependencies = [
"libc",
"pyo3-build-config",
@@ -1402,27 +1385,27 @@
[[package]]
name = "pyo3-macros"
-version = "0.20.3"
+version = "0.22.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7305c720fa01b8055ec95e484a6eca7a83c841267f0dd5280f0c8b8551d2c158"
+checksum = "eb57983022ad41f9e683a599f2fd13c3664d7063a3ac5714cae4b7bee7d3f206"
dependencies = [
"proc-macro2",
"pyo3-macros-backend",
"quote",
- "syn 2.0.58",
+ "syn 2.0.72",
]
[[package]]
name = "pyo3-macros-backend"
-version = "0.20.3"
+version = "0.22.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7c7e9b68bb9c3149c5b0cade5d07f953d6d125eb4337723c4ccdb665f1f96185"
+checksum = "ec480c0c51ddec81019531705acac51bcdbeae563557c982aa8263bb96880372"
dependencies = [
- "heck",
+ "heck 0.5.0",
"proc-macro2",
"pyo3-build-config",
"quote",
- "syn 2.0.58",
+ "syn 2.0.72",
]
[[package]]
@@ -1501,15 +1484,6 @@
"rand_core 0.3.1",
]
-[[package]]
-name = "redox_syscall"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
-dependencies = [
- "bitflags 1.3.2",
-]
-
[[package]]
name = "regex"
version = "1.10.4"
@@ -1670,7 +1644,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.58",
+ "syn 2.0.72",
]
[[package]]
@@ -1807,9 +1781,9 @@
[[package]]
name = "syn"
-version = "2.0.58"
+version = "2.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687"
+checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af"
dependencies = [
"proc-macro2",
"quote",
@@ -1882,7 +1856,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.58",
+ "syn 2.0.72",
]
[[package]]
@@ -1925,7 +1899,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.58",
+ "syn 2.0.72",
]
[[package]]
@@ -2174,7 +2148,7 @@
"once_cell",
"proc-macro2",
"quote",
- "syn 2.0.58",
+ "syn 2.0.72",
"wasm-bindgen-shared",
]
@@ -2196,7 +2170,7 @@
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.58",
+ "syn 2.0.72",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
diff --git a/chronik/chronik-plugin-impl/Cargo.toml b/chronik/chronik-plugin-impl/Cargo.toml
--- a/chronik/chronik-plugin-impl/Cargo.toml
+++ b/chronik/chronik-plugin-impl/Cargo.toml
@@ -23,7 +23,7 @@
convert_case = "0.6"
# Rust bindings for the Python interpreter
-pyo3 = { version = "0.20" }
+pyo3 = { version = "0.22" }
# Serialize structs
serde = { version = "1.0", features = ["derive"] }
diff --git a/chronik/chronik-plugin-impl/src/context.rs b/chronik/chronik-plugin-impl/src/context.rs
--- a/chronik/chronik-plugin-impl/src/context.rs
+++ b/chronik/chronik-plugin-impl/src/context.rs
@@ -16,7 +16,7 @@
use chronik_plugin_common::{params::PluginParams, plugin::Plugin};
use chronik_util::log;
use pyo3::{
- types::{PyList, PyModule},
+ types::{PyAnyMethods, PyList, PyListMethods, PyModule},
Python,
};
use serde::Deserialize;
@@ -101,14 +101,14 @@
pyo3::prepare_freethreaded_python();
Python::with_gil(|py| -> Result<_> {
// Extract the Python version
- let version = PyModule::import(py, "platform")?
+ let version = PyModule::import_bound(py, "platform")?
.getattr("python_version")?
.call0()?
.extract::<String>()?;
log!("Plugin context initialized Python {}\n", version);
// Add <datadir>/plugins to sys.path
- PyModule::import(py, "sys")?
+ PyModule::import_bound(py, "sys")?
.getattr("path")?
.downcast::<PyList>()
.unwrap()
@@ -116,7 +116,7 @@
// Load the chronik Plugin class
let plugin_module =
- match PyModule::import(py, "chronik_plugin.plugin") {
+ match PyModule::import_bound(py, "chronik_plugin.plugin") {
Ok(plugin_module) => plugin_module,
Err(err) => {
err.print(py);
@@ -131,7 +131,7 @@
py,
module_name.clone(),
plugin_spec.class,
- plugin_cls,
+ &plugin_cls,
) {
Ok(plugin) => plugin,
Err(err) => {
diff --git a/chronik/chronik-plugin-impl/src/module.rs b/chronik/chronik-plugin-impl/src/module.rs
--- a/chronik/chronik-plugin-impl/src/module.rs
+++ b/chronik/chronik-plugin-impl/src/module.rs
@@ -10,30 +10,33 @@
/// Python module for Chronik plugins
#[pymodule]
-pub fn chronik_plugin(py: Python<'_>, module: &PyModule) -> PyResult<()> {
- let script_module = PyModule::new(py, "script")?;
+pub fn chronik_plugin(
+ py: Python<'_>,
+ module: Bound<'_, PyModule>,
+) -> PyResult<()> {
+ let script_module = PyModule::new_bound(py, "script")?;
script_module.add_class::<Op>()?;
script_module.add_class::<Script>()?;
- module.add_submodule(script_module)?;
+ module.add_submodule(&script_module)?;
// Need to register submodule manually, see PyO3#759
py_run!(
py,
script_module,
"import sys; sys.modules['chronik_plugin.script'] = script_module"
);
- PyModule::from_code(
+ PyModule::from_code_bound(
py,
include_str!("plugin.py"),
"plugin.py",
"chronik_plugin.plugin",
)?;
- PyModule::from_code(
+ PyModule::from_code_bound(
py,
include_str!("token.py"),
"token.py",
"chronik_plugin.token",
)?;
- PyModule::from_code(
+ PyModule::from_code_bound(
py,
include_str!("tx.py"),
"tx.py",
@@ -49,8 +52,9 @@
/// Add functional test folder to PYTHONPATH so we can use its utils
pub fn add_test_framework_to_pythonpath(py: Python<'_>) -> PyResult<()> {
- let sys = PyModule::import(py, "sys")?;
- let sys_path = sys.getattr("path")?.downcast::<PyList>()?;
+ let sys = PyModule::import_bound(py, "sys")?;
+ let path = sys.getattr("path")?;
+ let sys_path = path.downcast::<PyList>()?;
let functional_path =
concat!(env!("CARGO_MANIFEST_DIR"), "/../../test/functional");
diff --git a/chronik/chronik-plugin-impl/src/plugin.rs b/chronik/chronik-plugin-impl/src/plugin.rs
--- a/chronik/chronik-plugin-impl/src/plugin.rs
+++ b/chronik/chronik-plugin-impl/src/plugin.rs
@@ -9,8 +9,8 @@
use chronik_plugin_common::plugin::Plugin;
use convert_case::{Case, Casing};
use pyo3::{
- types::{PyDict, PyModule},
- PyAny, Python,
+ types::{PyAnyMethods, PyDict, PyModule},
+ Bound, PyAny, Python,
};
use thiserror::Error;
use versions::SemVer;
@@ -59,9 +59,9 @@
py: Python<'py>,
module_name: String,
class_name: Option<String>,
- plugin_cls: &'py PyAny,
+ plugin_cls: &Bound<'py, PyAny>,
) -> Result<Plugin> {
- let module = PyModule::import(py, module_name.as_str())
+ let module = PyModule::import_bound(py, module_name.as_str())
.map_err(|err| FailedImportingModule(err.to_string()))?;
// Class name is either NamePascalCasePlugin, or manually specified
@@ -75,7 +75,7 @@
.map_err(|_| ClassNotFound(class_name.clone()))?;
// Empty config object for now
- let config = PyDict::new(py);
+ let config = PyDict::new_bound(py);
let plugin_instance = class.call1((config,))?;
// Must be a Plugin instance
@@ -83,17 +83,15 @@
return Err(ClassMustDerivePlugin(class_name.clone()).into());
}
- let lokad_id = plugin_instance
- .getattr("lokad_id")?
- .call0()?
+ let lokad_id = plugin_instance.getattr("lokad_id")?.call0()?;
+ let lokad_id = lokad_id
.extract::<&[u8]>()
.map_err(|err| InvalidLokadIdType(err.to_string()))?;
let lokad_id: LokadId = lokad_id
.try_into()
.map_err(|_| InvalidLokadIdLen(lokad_id.len()))?;
- let version = plugin_instance
- .getattr("version")?
- .call0()?
+ let version = plugin_instance.getattr("version")?.call0()?;
+ let version = version
.extract::<&str>()
.map_err(|err| InvalidVersionType(err.to_string()))?;
let version = SemVer::new(version)
diff --git a/chronik/chronik-plugin-impl/src/script.rs b/chronik/chronik-plugin-impl/src/script.rs
--- a/chronik/chronik-plugin-impl/src/script.rs
+++ b/chronik/chronik-plugin-impl/src/script.rs
@@ -4,6 +4,8 @@
//! Module for [`Script`] and [`Op`] for plugins.
+#![allow(unsafe_code)]
+
use bitcoinsuite_core::script;
use pyo3::{exceptions::PyValueError, prelude::*, types::PyBytes};
@@ -38,7 +40,7 @@
impl Script {
/// Create a new [`Script`] from a `bytes` object.
#[new]
- pub fn __init__(bytes: &PyBytes) -> Self {
+ pub fn __init__(bytes: Bound<'_, PyBytes>) -> Self {
Script::new(script::Script::new(bytes.as_bytes().to_vec().into()))
}
@@ -54,8 +56,8 @@
}
/// The serialized bytecode of the Script
- pub fn bytecode<'py>(&self, py: Python<'py>) -> &'py PyBytes {
- PyBytes::new(py, self.script.bytecode())
+ pub fn bytecode<'py>(&self, py: Python<'py>) -> Bound<'py, PyBytes> {
+ PyBytes::new_bound(py, self.script.bytecode())
}
/// List of the operations in this script.
@@ -71,7 +73,7 @@
pushdata: match op {
script::Op::Code(_) => None,
script::Op::Push(_, bytes) => {
- Some(PyBytes::new(py, &bytes).into())
+ Some(PyBytes::new_bound(py, &bytes).into())
}
},
})
diff --git a/chronik/chronik-plugin-impl/src/token.rs b/chronik/chronik-plugin-impl/src/token.rs
--- a/chronik/chronik-plugin-impl/src/token.rs
+++ b/chronik/chronik-plugin-impl/src/token.rs
@@ -25,7 +25,7 @@
impl TokenModule {
/// Import the `token.py` module
pub fn import(py: Python<'_>) -> PyResult<Self> {
- let token_module = PyModule::import(py, "chronik_plugin.token")?;
+ let token_module = PyModule::import_bound(py, "chronik_plugin.token")?;
Ok(TokenModule {
cls_genesis_info: token_module.getattr("GenesisInfo")?.into(),
cls_token_tx_entry: token_module.getattr("TokenTxEntry")?.into(),
@@ -39,7 +39,7 @@
py: Python<'_>,
info: &GenesisInfo,
) -> PyResult<PyObject> {
- let kwargs = PyDict::new(py);
+ let kwargs = PyDict::new_bound(py);
kwargs.set_item("token_ticker", to_bytes(py, &info.token_ticker))?;
kwargs.set_item("token_name", to_bytes(py, &info.token_name))?;
kwargs.set_item(
@@ -63,7 +63,7 @@
)?;
kwargs.set_item("decimals", info.decimals)?;
- self.cls_genesis_info.call(py, (), Some(kwargs))
+ self.cls_genesis_info.call_bound(py, (), Some(&kwargs))
}
/// Bridge the [`TokenTxEntry`] to its Python equivalent.
@@ -72,7 +72,7 @@
py: Python<'_>,
entry: &TokenTxEntry,
) -> PyResult<PyObject> {
- let kwargs = PyDict::new(py);
+ let kwargs = PyDict::new_bound(py);
kwargs.set_item("token_id", entry.meta.token_id.to_string())?;
kwargs.set_item(
"token_protocol",
@@ -115,7 +115,7 @@
.transpose()?,
)?;
- self.cls_token_tx_entry.call(py, (), Some(kwargs))
+ self.cls_token_tx_entry.call_bound(py, (), Some(&kwargs))
}
/// Bridge the token to a Python `Token` object, reusing some objects from
@@ -127,7 +127,7 @@
entry_idx: usize,
token_variant: TokenVariant,
) -> PyResult<PyObject> {
- let kwargs = PyDict::new(py);
+ let kwargs = PyDict::new_bound(py);
kwargs.set_item("token_id", entry.getattr(py, "token_id")?)?;
kwargs
.set_item("token_protocol", entry.getattr(py, "token_protocol")?)?;
@@ -136,6 +136,6 @@
kwargs.set_item("amount", token_variant.amount())?;
kwargs.set_item("is_mint_baton", token_variant.is_mint_baton())?;
- self.cls_token.call(py, (), Some(kwargs))
+ self.cls_token.call_bound(py, (), Some(&kwargs))
}
}
diff --git a/chronik/chronik-plugin-impl/src/tx.rs b/chronik/chronik-plugin-impl/src/tx.rs
--- a/chronik/chronik-plugin-impl/src/tx.rs
+++ b/chronik/chronik-plugin-impl/src/tx.rs
@@ -31,7 +31,7 @@
impl TxModule {
/// Import the `tx.py` module
pub fn import(py: Python<'_>) -> PyResult<Self> {
- let tx_module = PyModule::import(py, "chronik_plugin.tx")?;
+ let tx_module = PyModule::import_bound(py, "chronik_plugin.tx")?;
Ok(TxModule {
cls_tx: tx_module.getattr("Tx")?.into(),
cls_out_point: tx_module.getattr("OutPoint")?.into(),
@@ -48,7 +48,7 @@
tx: &Tx,
token_data: Option<(&TokenTx, &[Option<SpentToken>])>,
) -> PyResult<PyObject> {
- let py_empp_data = PyList::empty(py);
+ let py_empp_data = PyList::empty_bound(py);
if let Some(first_output) = tx.outputs.first() {
let empp_data = empp::parse(&first_output.script)
.ok()
@@ -72,7 +72,7 @@
spent_tokens = Some(tokens);
output_tokens = Some(&token_tx.outputs);
}
- let kwargs = PyDict::new(py);
+ let kwargs = PyDict::new_bound(py);
kwargs.set_item("txid", to_bytes(py, tx.txid().as_bytes()))?;
kwargs.set_item("version", tx.version)?;
kwargs.set_item(
@@ -111,7 +111,7 @@
kwargs.set_item("lock_time", tx.locktime)?;
kwargs.set_item("token_entries", py_entries)?;
kwargs.set_item("empp_data", py_empp_data)?;
- self.cls_tx.call(py, (), Some(kwargs))
+ self.cls_tx.call_bound(py, (), Some(&kwargs))
}
/// Bridge the [`OutPoint`] to its Python equivalent
@@ -132,7 +132,7 @@
token_output: Option<&TokenOutput>,
py_token_entries: &[PyObject],
) -> PyResult<PyObject> {
- let kwargs = PyDict::new(py);
+ let kwargs = PyDict::new_bound(py);
kwargs.set_item(
"script",
Py::new(py, Script::new(output.script.clone()))?,
@@ -151,7 +151,7 @@
})
.transpose()?,
)?;
- self.cls_tx_output.call(py, (), Some(kwargs))
+ self.cls_tx_output.call_bound(py, (), Some(&kwargs))
}
/// Bridge the [`TxInput`] and attached token data to is Python equivalent.
@@ -163,7 +163,7 @@
py_token_entries: &[PyObject],
entries: &[TokenTxEntry],
) -> PyResult<PyObject> {
- let kwargs = PyDict::new(py);
+ let kwargs = PyDict::new_bound(py);
kwargs.set_item(
"prev_out",
self.bridge_out_point(py, &input.prev_out)?,
@@ -189,7 +189,7 @@
.transpose()?,
)?;
kwargs.set_item("sequence", input.sequence)?;
- self.cls_tx_input.call(py, (), Some(kwargs))
+ self.cls_tx_input.call_bound(py, (), Some(&kwargs))
}
fn bridge_input_output(
@@ -200,7 +200,7 @@
py_token_entries: &[PyObject],
entries: &[TokenTxEntry],
) -> PyResult<PyObject> {
- let kwargs = PyDict::new(py);
+ let kwargs = PyDict::new_bound(py);
kwargs.set_item(
"script",
Py::new(py, Script::new(output.script.clone()))?,
@@ -222,6 +222,6 @@
})
.transpose()?,
)?;
- self.cls_tx_output.call(py, (), Some(kwargs))
+ self.cls_tx_output.call_bound(py, (), Some(&kwargs))
}
}
diff --git a/chronik/chronik-plugin-impl/src/util.rs b/chronik/chronik-plugin-impl/src/util.rs
--- a/chronik/chronik-plugin-impl/src/util.rs
+++ b/chronik/chronik-plugin-impl/src/util.rs
@@ -5,5 +5,5 @@
use pyo3::{types::PyBytes, Py, Python};
pub(crate) fn to_bytes(py: Python<'_>, bytes: &[u8]) -> Py<PyBytes> {
- PyBytes::new(py, bytes).into()
+ PyBytes::new_bound(py, bytes).into()
}
diff --git a/chronik/chronik-plugin-impl/tests/test_script_to_py.rs b/chronik/chronik-plugin-impl/tests/test_script_to_py.rs
--- a/chronik/chronik-plugin-impl/tests/test_script_to_py.rs
+++ b/chronik/chronik-plugin-impl/tests/test_script_to_py.rs
@@ -8,7 +8,10 @@
module::{add_test_framework_to_pythonpath, load_plugin_module},
script::Script,
};
-use pyo3::{types::PyModule, Python};
+use pyo3::{
+ types::{PyAnyMethods, PyModule},
+ Python,
+};
#[test]
fn test_py_script() -> Result<()> {
@@ -17,7 +20,7 @@
Python::with_gil(|py| -> Result<_> {
add_test_framework_to_pythonpath(py)?;
- let test_module = PyModule::from_code(
+ let test_module = PyModule::from_code_bound(
py,
include_str!("test_script_to_py.py"),
"test_script_to_py.py",
diff --git a/chronik/chronik-plugin-impl/tests/test_tx_to_py.rs b/chronik/chronik-plugin-impl/tests/test_tx_to_py.rs
--- a/chronik/chronik-plugin-impl/tests/test_tx_to_py.rs
+++ b/chronik/chronik-plugin-impl/tests/test_tx_to_py.rs
@@ -29,7 +29,10 @@
module::{add_test_framework_to_pythonpath, load_plugin_module},
tx::TxModule,
};
-use pyo3::{types::PyModule, PyErr, PyObject, PyResult, Python};
+use pyo3::{
+ types::{PyAnyMethods, PyModule},
+ PyErr, PyObject, PyResult, Python,
+};
fn make_py_tx(
py: Python<'_>,
@@ -129,7 +132,7 @@
let tx_module = TxModule::import(py)?;
- let test_module = PyModule::from_code(
+ let test_module = PyModule::from_code_bound(
py,
include_str!("test_tx_to_py.py"),
"test_tx_to_py.py",
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 20, 22:21 (21 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5866051
Default Alt Text
D16523.id48830.diff (21 KB)
Attached To
D16523: [Chronik] Upgrade pyo3 to 0.22
Event Timeline
Log In to Comment