Skip to content

Commit

Permalink
Disable gil-refs feature
Browse files Browse the repository at this point in the history
  • Loading branch information
dvolodin7 committed Nov 6, 2024
1 parent 039e8ce commit 7b327a1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ digest = "0.10"
enum_dispatch = "0.3"
md-5 = "0.10"
nom = "7.1"
pyo3 = {version = "0.22", features = ["extension-module", "gil-refs"]}
pyo3 = {version = "0.22", features = ["extension-module"]}
rand = "0.8"
sha1 = "0.10"
socket2 = {version = "0.5", features = ["all"]}
Expand Down
8 changes: 4 additions & 4 deletions src/snmp/op/getmany.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ use crate::error::SnmpError;
use crate::snmp::get::SnmpGet;
use crate::snmp::msg::SnmpPdu;
use crate::snmp::value::SnmpValue;
use pyo3::{exceptions::PyRuntimeError, prelude::*, types::PyDict};
use pyo3::{exceptions::PyRuntimeError, prelude::*, pybacked::PyBackedStr, types::PyDict};

pub struct OpGetMany;

impl<'a> PyOp<'a, Vec<&'a str>> for OpGetMany {
impl<'a> PyOp<'a, Vec<PyBackedStr>> for OpGetMany {
// obj is list[str]
fn from_python(obj: Vec<&'a str>, request_id: i64) -> PyResult<SnmpPdu<'a>> {
fn from_python(obj: Vec<PyBackedStr>, request_id: i64) -> PyResult<SnmpPdu<'a>> {
Ok(SnmpPdu::GetRequest(SnmpGet {
request_id,
vars: obj
.into_iter()
.map(SnmpOid::try_from)
.map(|x| SnmpOid::try_from(x.as_ref()))
.collect::<Result<Vec<SnmpOid>, SnmpError>>()?,
}))
}
Expand Down
6 changes: 3 additions & 3 deletions src/socket/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{
pdu::SnmpPdu,
},
};
use pyo3::prelude::*;
use pyo3::{prelude::*, pybacked::PyBackedStr};
use socket2::Socket;
use std::os::fd::AsRawFd;

Expand Down Expand Up @@ -66,11 +66,11 @@ impl SnmpV1ClientSocket {
}
// .get_many()
// Prepare and send GET request with multiple oids and receive reply
fn get_many(&mut self, py: Python, oids: Vec<&str>) -> PyResult<PyObject> {
fn get_many(&mut self, py: Python, oids: Vec<PyBackedStr>) -> PyResult<PyObject> {
Self::send_and_recv::<OpGetMany, _>(self, oids, None, py)
}
// Prepare and send GET request with multiple oids
fn send_get_many(&mut self, py: Python, oids: Vec<&str>) -> PyResult<()> {
fn send_get_many(&mut self, py: Python, oids: Vec<PyBackedStr>) -> PyResult<()> {
Self::send_request::<OpGetMany, _>(self, oids, py)
}
fn recv_get_many(&mut self, py: Python) -> PyResult<PyObject> {
Expand Down
6 changes: 3 additions & 3 deletions src/socket/v2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{
pdu::SnmpPdu,
},
};
use pyo3::prelude::*;
use pyo3::{prelude::*, pybacked::PyBackedStr};
use socket2::Socket;
use std::os::fd::AsRawFd;

Expand Down Expand Up @@ -65,11 +65,11 @@ impl SnmpV2cClientSocket {
}
// .get_many()
// Prepare and send GET request with multiple oids and receive reply
fn get_many(&mut self, py: Python, oids: Vec<&str>) -> PyResult<PyObject> {
fn get_many(&mut self, py: Python, oids: Vec<PyBackedStr>) -> PyResult<PyObject> {
Self::send_and_recv::<OpGetMany, _>(self, oids, None, py)
}
// Prepare and send GET request with multiple oids
fn send_get_many(&mut self, py: Python, oids: Vec<&str>) -> PyResult<()> {
fn send_get_many(&mut self, py: Python, oids: Vec<PyBackedStr>) -> PyResult<()> {
Self::send_request::<OpGetMany, _>(self, oids, py)
}
fn recv_get_many(&mut self, py: Python) -> PyResult<PyObject> {
Expand Down
6 changes: 3 additions & 3 deletions src/socket/v3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use crate::{
snmp::op::{GetIter, OpGet, OpGetBulk, OpGetMany, OpGetNext, OpRefresh},
snmp::pdu::SnmpPdu,
};
use pyo3::prelude::*;
use pyo3::types::PyBytes;
use pyo3::{prelude::*, pybacked::PyBackedStr};
use socket2::Socket;
use std::os::fd::AsRawFd;

Expand Down Expand Up @@ -129,11 +129,11 @@ impl SnmpV3ClientSocket {
}
// .get_many()
// Prepare and send GET request with multiple oids and receive reply
fn get_many(&mut self, py: Python, oids: Vec<&str>) -> PyResult<PyObject> {
fn get_many(&mut self, py: Python, oids: Vec<PyBackedStr>) -> PyResult<PyObject> {
Self::send_and_recv::<OpGetMany, _>(self, oids, None, py)
}
// Prepare and send GET request with multiple oids
fn send_get_many(&mut self, py: Python, oids: Vec<&str>) -> PyResult<()> {
fn send_get_many(&mut self, py: Python, oids: Vec<PyBackedStr>) -> PyResult<()> {
Self::send_request::<OpGetMany, _>(self, oids, py)
}
fn recv_get_many(&mut self, py: Python) -> PyResult<PyObject> {
Expand Down

0 comments on commit 7b327a1

Please sign in to comment.