Skip to content

Conversation

@ShaharNaveh
Copy link
Collaborator

@ShaharNaveh ShaharNaveh commented Dec 12, 2025

Summary by CodeRabbit

  • New Features
    • Added a new sys module function to query Global Interpreter Lock (GIL) status. Users can now check the GIL implementation state programmatically.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 12, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • Lib/test/test_sys.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

Walkthrough

A new _is_gil_enabled() function was added to the sys module as a Python-exposed const function that returns false, indicating the GIL is not implemented in this environment.

Changes

Cohort / File(s) Summary
GIL Status Function
crates/vm/src/stdlib/sys.rs
Added new #[pyfunction] const fn _is_gil_enabled() -> bool that returns false to signal GIL is not available

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested reviewers

  • youknowone

Poem

🐰 A GIL check hops into sys today,
Returns false in a gentle way,
No locks will bind these concurrent threads,
Freedom in code, the rabbit thread spreads! 🧵✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions updating test_sys.py from 3.13.11, but the actual changes add a new _is_gil_enabled() function to the sys module implementation, not test updates. Update the title to accurately reflect the main change, such as 'Add _is_gil_enabled() function to sys module' or similar.
✅ Passed checks (2 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%.

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.


# TODO: RUSTPYTHON, AtExit.__del__ is not invoked because module destruction is missing.
@unittest.expectedFailure
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: False is not true
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seems like

sysconfig.get_config_var('Py_GIL_DISABLED')

returns None (should return 1)

@youknowone
Copy link
Member

Currently fn exit in sys.rs is not checking the range of exit code. Checking it and return -1 for overflow will fix the failing test_exit

@youknowone youknowone force-pushed the update-test-sys branch 2 times, most recently from 88134cc to d3bb267 Compare December 31, 2025 11:26
@youknowone youknowone mentioned this pull request Jan 1, 2026
@youknowone youknowone force-pushed the update-test-sys branch 3 times, most recently from f5fedb3 to bd538ac Compare January 1, 2026 07:54
@youknowone youknowone merged commit 3e2ada0 into RustPython:main Jan 1, 2026
13 checks passed
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.

2 participants