@@ -134,6 +134,13 @@ impl Size {
134134 }
135135}
136136
137+ // TODO: Once the minimum Python version is >= 3.10, use a `self_cell`
138+ // to store the owned PyString along with the dependent Asn1PrintableString
139+ // in order to avoid verifying the string twice (once during construction,
140+ // and again during serialization).
141+ // This is because for Python < 3.10 getting an Asn1PrintableString object
142+ // from a PyString requires calling `to_cow()`, which creates an intermediate
143+ // `Cow` object with a different lifetime from the PyString.
137144#[ derive( pyo3:: FromPyObject ) ]
138145#[ pyo3:: pyclass( frozen, module = "cryptography.hazmat.bindings._rust.asn1" ) ]
139146pub struct PrintableString {
@@ -168,6 +175,13 @@ impl PrintableString {
168175 }
169176}
170177
178+ // TODO: Once the minimum Python version is >= 3.10, use a `self_cell`
179+ // to store the owned PyString along with the dependent Asn1IA5String
180+ // in order to avoid verifying the string twice (once during construction,
181+ // and again during serialization).
182+ // This is because for Python < 3.10 getting an Asn1IA5String object
183+ // from a PyString requires calling `to_cow()`, which creates an intermediate
184+ // `Cow` object with a different lifetime from the PyString.
171185#[ derive( pyo3:: FromPyObject ) ]
172186#[ pyo3:: pyclass( frozen, module = "cryptography.hazmat.bindings._rust.asn1" ) ]
173187pub struct IA5String {
0 commit comments