Skip to content

Commit 50c9a7c

Browse files
authored
asn1: Add TODO comment for uses of PyStringMethods::to_cow (#13986)
Signed-off-by: Facundo Tuesca <[email protected]>
1 parent ef636a0 commit 50c9a7c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/rust/src/declarative_asn1/encode.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ impl asn1::Asn1Writable for AnnotatedTypeObject<'_> {
138138
let val: &pyo3::Bound<'_, PrintableString> = value
139139
.cast()
140140
.map_err(|_| asn1::WriteError::AllocationError)?;
141+
// TODO: Switch this to `to_str()` once our minimum version is py310+
141142
let inner_str = val
142143
.get()
143144
.inner
@@ -152,6 +153,7 @@ impl asn1::Asn1Writable for AnnotatedTypeObject<'_> {
152153
let val: &pyo3::Bound<'_, IA5String> = value
153154
.cast()
154155
.map_err(|_| asn1::WriteError::AllocationError)?;
156+
// TODO: Switch this to `to_str()` once our minimum version is py310+
155157
let inner_str = val
156158
.get()
157159
.inner

src/rust/src/declarative_asn1/types.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ impl PrintableString {
143143
#[new]
144144
#[pyo3(signature = (inner,))]
145145
fn new(py: pyo3::Python<'_>, inner: pyo3::Py<pyo3::types::PyString>) -> pyo3::PyResult<Self> {
146+
// TODO: Switch this to `to_str()` once our minimum version is py310+
146147
if Asn1PrintableString::new(&inner.to_cow(py)?).is_none() {
147148
return Err(pyo3::exceptions::PyValueError::new_err(format!(
148149
"invalid PrintableString: {inner}"
@@ -176,6 +177,7 @@ impl IA5String {
176177
#[new]
177178
#[pyo3(signature = (inner,))]
178179
fn new(py: pyo3::Python<'_>, inner: pyo3::Py<pyo3::types::PyString>) -> pyo3::PyResult<Self> {
180+
// TODO: Switch this to `to_str()` once our minimum version is py310+
179181
if Asn1IA5String::new(&inner.to_cow(py)?).is_none() {
180182
return Err(pyo3::exceptions::PyValueError::new_err(format!(
181183
"invalid IA5String: {inner}"

0 commit comments

Comments
 (0)