Skip to content

Commit 71c0586

Browse files
committed
Remove PyBackedStr usage
Signed-off-by: Facundo Tuesca <[email protected]>
1 parent 14a19a7 commit 71c0586

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/rust/src/declarative_asn1/encode.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// for complete details.
44

55
use asn1::{SimpleAsn1Writable, Writer};
6-
use pyo3::types::PyAnyMethods;
6+
use pyo3::types::{PyAnyMethods, PyStringMethods};
77

88
use crate::declarative_asn1::types::{AnnotatedType, AnnotatedTypeObject, PrintableString, Type};
99

@@ -77,13 +77,14 @@ impl asn1::Asn1Writable for AnnotatedTypeObject<'_> {
7777
let val: &pyo3::Bound<'_, PrintableString> = value
7878
.downcast()
7979
.map_err(|_| asn1::WriteError::AllocationError)?;
80-
let inner_str: pyo3::pybacked::PyBackedStr = val
80+
let inner_str = val
8181
.get()
8282
.inner
83-
.extract(py)
83+
.bind(py)
84+
.to_str()
8485
.map_err(|_| asn1::WriteError::AllocationError)?;
8586
let printable_string: asn1::PrintableString<'_> =
86-
asn1::PrintableString::new(&inner_str)
87+
asn1::PrintableString::new(inner_str)
8788
.ok_or(asn1::WriteError::AllocationError)?;
8889
write_value(writer, &printable_string)
8990
}

0 commit comments

Comments
 (0)