◐ Shell
clean mode source ↗

Update `{site,sysconfig}.py` from 3.13.7 by ShaharNaveh · Pull Request #6132 · RustPython/RustPython

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • Lib/test/test_faulthandler.py is excluded by !Lib/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds a new internal stdlib module _sysconfig (unconditionally compiled), registers it in the VM’s stdlib initializer map, and exposes a config_vars function that returns a dict with Py_GIL_DISABLED: True.

Changes

Cohort / File(s) Summary
Stdlib module registration
vm/src/stdlib/mod.rs
Adds mod sysconfig; and registers "_sysconfig" => sysconfig::make_module in get_module_inits().
_sysconfig module implementation & re-export
vm/src/stdlib/sysconfig.rs
Adds new PyO3-backed module pub(crate) mod sysconfig annotated #[pymodule(name = "_sysconfig")] exposing config_vars(vm) -> PyDictRef that returns a dict with Py_GIL_DISABLED: True, and re-exports make_module via pub(crate) use sysconfig::make_module;.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor App
    participant VM
    participant StdlibRegistry as "Stdlib Init Map"
    participant Sysconfig as "_sysconfig Module"

    App->>VM: import _sysconfig
    VM->>StdlibRegistry: lookup make_module("_sysconfig")
    StdlibRegistry-->>VM: sysconfig::make_module
    VM->>Sysconfig: initialize module
    VM-->>App: _sysconfig handle

    App->>Sysconfig: config_vars()
    activate Sysconfig
    Note over Sysconfig: Build dict {"Py_GIL_DISABLED": True}
    Sysconfig-->>App: PyDict
    deactivate Sysconfig
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I nibble bytes where tunnels wind,
A tiny module I designed—
I set a flag, then hop away,
Py_GIL_DISABLED, yes, hooray! 🐇

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.