Skip to content

Conversation

@youknowone
Copy link
Member

@youknowone youknowone commented Jan 1, 2026

Summary by CodeRabbit

  • New Features

    • Added exception hook support for thread operations with improved exception reporting.
  • Bug Fixes

    • Improved ioctl() parameter handling for enhanced platform compatibility.
    • Enhanced type validation in super() builtin with clearer error messages.
    • Fixed warning context tracking to accurately report source locations.
    • Optimized garbage collection behavior for SSL socket objects.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 1, 2026

📝 Walkthrough

Walkthrough

The changes span multiple subsystems: ioctl's parameter type widening from u32 to i64 with runtime bit-pattern casting, SSL socket garbage collection optimization through traversal markers, super() function's type argument validation enhancement, new thread exception hook infrastructure with a dedicated argument class, and warning context setup flow adjustments for frame availability handling.

Changes

Cohort / File(s) Summary
I/O Control Parameter Handling
crates/stdlib/src/fcntl.rs
Modified ioctl() to accept request as i64 instead of u32, with runtime reinterpretation via cast to u32 then zero-extended to libc::c_ulong to handle negative bit-pattern values.
SSL Socket Garbage Collection
crates/stdlib/src/ssl.rs
Enabled traverse on PySSLSocket pyclass and marked 10 fields (server_side, server_hostname, connection, handshake_done, session_was_reused, verified_chain, sni_state, client_hello_buffer, shutdown_state, deferred_cert_error) with pytraverse(skip) to exclude them from Python-side GC traversals.
Super Type Validation
crates/vm/src/builtins/super.rs
Changed InitArgs.py_type field from OptionalArg<PyTypeRef> to OptionalArg<PyObjectRef> and added runtime downcast with type validation; raises error if first argument is not a type.
Thread Exception Hook Infrastructure
crates/vm/src/stdlib/thread.rs
Added ExceptHookArgs pyclass (_ExceptHookArgs) with four fields (exc_type, exc_value, exc_traceback, thread) and accessor properties; added _excepthook() pyfunction to handle exception hook invocation with traceback printing to appropriate stderr target.
Warning Context Setup
crates/vm/src/warn.rs
Updated setup_context() control flow: when a frame exists but wasn't stack-discovered, use its globals with filename "<sys>" and lineno 1; added fallback path for no-frame case using sys.__dict__ as globals with lineno 0, replacing prior single fallback using vm.current_globals().

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~35 minutes

Possibly related PRs

Suggested reviewers

  • ShaharNaveh
  • arihant2math

Poem

🐰 Hops with glee through RustPython's halls,
Casting types and marking traversals!
SSL sockets skip through GC's delight,
While super() validates with all its might.
Thread exceptions and warnings align—
A patchwork of fixes, how sublime!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title directly references the four main changes: fcntl fixes, sslsocket traverse fixes, super fixes, and excepthook additions—accurately capturing the pull request's scope.
✨ Finishing touches
  • 📝 Generate docstrings

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 and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 2, 2026

Code has been automatically formatted

The code in this PR has been formatted using cargo fmt --all.
Please pull the latest changes before pushing again:

git pull origin manifix

@youknowone youknowone marked this pull request as ready for review January 2, 2026 14:37
@youknowone youknowone changed the title various bug fixes fix fcntl, sslsocket traverse, super , excepthook Jan 2, 2026
@youknowone youknowone merged commit 0eddee5 into RustPython:main Jan 2, 2026
13 checks passed
@youknowone youknowone deleted the manifix branch January 2, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant