Skip to content

Use socket repr in deallocation warnings - #8422

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

Use socket repr in deallocation warnings#8422
youknowone merged 1 commit into
RustPython:mainfrom
kyokuping:codex/fix-ssl-dealloc-warning

Conversation

@kyokuping

@kyokuping kyokuping commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Assisted-by: Codex:gpt-5.6-sol

Summary

  • enable test_ssl.test_dealloc_warn
  • Use the socket object's repr in resource warnings so SSL sockets are identified correctly.

Summary by CodeRabbit

  • Bug Fixes
    • Improved unclosed socket warnings by displaying a clearer socket representation.
    • Added a safe fallback message when the socket representation cannot be generated.

@coderabbitai

coderabbitai Bot commented Jul 31, 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: c4afcfb7-e3ac-45ca-ae0a-4d884694fea7

📥 Commits

Reviewing files that changed from the base of the PR and between f08933b and 76ec852.

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

📝 Walkthrough

Walkthrough

The unclosed socket warning now uses the socket object's repr. If representation fails, the warning uses <socket> instead of manually formatted socket metadata.

Changes

Socket warning handling

Layer / File(s) Summary
Use socket representation for warnings
crates/stdlib/src/socket.rs
The unclosed socket warning derives its message from PySocket representation output and falls back to <socket> when representation fails.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: youknowone, shaharnaveh

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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 change: using socket representations in deallocation warnings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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

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

@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 aa4f98a into RustPython:main Aug 1, 2026
28 checks passed
@kyokuping
kyokuping deleted the codex/fix-ssl-dealloc-warning 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