Skip to content

Commit 05f7f74

Browse files
authored
fix(ssl): make Certificate immutable and non-instantiable (RustPython#8417)
Assisted-by: Codex:gpt-5.6-sol
1 parent f08933b commit 05f7f74

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

Lib/test/test_ssl.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,6 @@ def test_options(self):
415415
value = getattr(ssl, name)
416416
self.assertGreaterEqual(value, 0, f"ssl.{name}")
417417

418-
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: TypeError not raised by Certificate
419418
def test_ssl_types(self):
420419
ssl_types = [
421420
_ssl._SSLContext,

crates/stdlib/src/openssl/cert.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ pub(crate) mod ssl_cert {
6767
}
6868
}
6969

70-
#[pyclass(with(Comparable, Hashable, Representable))]
70+
#[pyclass(
71+
flags(IMMUTABLETYPE, DISALLOW_INSTANTIATION),
72+
with(Comparable, Hashable, Representable)
73+
)]
7174
impl PySSLCertificate {
7275
#[pymethod]
7376
fn public_bytes(

crates/stdlib/src/ssl.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5040,7 +5040,10 @@ mod _ssl {
50405040
}
50415041
}
50425042

5043-
#[pyclass(with(Comparable, Hashable, Representable))]
5043+
#[pyclass(
5044+
flags(IMMUTABLETYPE, DISALLOW_INSTANTIATION),
5045+
with(Comparable, Hashable, Representable)
5046+
)]
50445047
impl PySSLCertificate {
50455048
#[pymethod]
50465049
fn public_bytes(

0 commit comments

Comments
 (0)