Skip to content

Make SSL Certificate immutable and non-instantiable - #8417

Merged
youknowone merged 1 commit into
RustPython:mainfrom
kyokuping:codex/fix-ssl-certificate-flags
Aug 1, 2026
Merged

Make SSL Certificate immutable and non-instantiable#8417
youknowone merged 1 commit into
RustPython:mainfrom
kyokuping:codex/fix-ssl-certificate-flags

Conversation

@kyokuping

@kyokuping kyokuping commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Assisted-by: Codex:gpt-5.6-sol

Summary

  • Apply the DISALLOW_INSTANTIATION and IMMUTABLETYPE flags to _ssl.Certificate in both the Rustls and OpenSSL backends.

Summary by CodeRabbit

  • Bug Fixes
    • SSL certificate objects are now immutable, preventing accidental modification after creation.
    • Direct instantiation of certificate objects is no longer allowed.
    • Existing comparison, hashing, and representation behavior remains unchanged.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9a54c782-db00-4f9e-a6bf-660322031e75

📥 Commits

Reviewing files that changed from the base of the PR and between 04c3ecf and fd9717c.

⛔ Files ignored due to path filters (1)
  • Lib/test/test_ssl.py is excluded by !Lib/**
📒 Files selected for processing (2)
  • crates/stdlib/src/openssl/cert.rs
  • crates/stdlib/src/ssl.rs

📝 Walkthrough

Walkthrough

The OpenSSL Certificate and PySSLCertificate Python types are now immutable and cannot be instantiated directly. Their comparison, hashing, and representation behavior remains unchanged.

Changes

SSL certificate type metadata

Layer / File(s) Summary
Certificate type metadata
crates/stdlib/src/openssl/cert.rs, crates/stdlib/src/ssl.rs
Both certificate classes add IMMUTABLETYPE and DISALLOW_INSTANTIATION flags while retaining their comparison, hashing, and representation traits.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: youknowone, shaharnaveh, joshuamegnauth54

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main changes: making SSL certificates immutable and non-instantiable.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

📦 Library Dependencies

The following Lib/ modules were modified. Here are their dependencies:

[x] lib: cpython/Lib/ssl.py
[x] test: cpython/Lib/test/test_ssl.py (TODO: 13)

dependencies:

  • ssl

dependent tests: (53 tests)

  • ssl: test_asyncio test_ftplib test_httplib test_httpservers test_imaplib test_logging test_poplib test_ssl test_urllib test_urllib2_localnet test_venv test_xmlrpc
    • asyncio.selector_events: test_asyncio
    • ftplib: test_urllib2
      • urllib.request: test_http_cookiejar test_pathlib test_pydoc test_sax test_site test_urllib2net test_urllibnet
    • http.client: test_docxmlrpc test_hashlib test_ucn test_unicodedata test_wsgiref
      • logging.handlers: test_concurrent_futures test_pkgutil
    • http.server: test_robotparser
      • pydoc: test_enum
    • smtplib: test_smtplib test_smtpnet
    • urllib.request:
      • pathlib: test_ast test_dbm_sqlite3 test_ensurepip test_importlib test_json test_launcher test_pathlib test_peg_generator test_pyrepl test_runpy test_tarfile test_tempfile test_tomllib test_tools test_traceback test_unparse test_winapi test_zipapp test_zipfile test_zoneinfo test_zstd

Legend:

  • [+] path exists in CPython
  • [x] up-to-date, [ ] outdated

@kyokuping
kyokuping marked this pull request as ready for review July 31, 2026 16:15
@youknowone youknowone added the z-ca-2026 Tag to track Contribution Academy 2026 label Aug 1, 2026

@youknowone youknowone left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@youknowone
youknowone merged commit 05f7f74 into RustPython:main Aug 1, 2026
28 checks passed
@kyokuping
kyokuping deleted the codex/fix-ssl-certificate-flags branch August 8, 2026 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

z-ca-2026 Tag to track Contribution Academy 2026

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants