Repository navigation
Expose sys._is_interned and order interned-state publication - #9430
youknowone merged 1 commit into
Conversation
Query the existing object flag without interning or content lookup. Mark only a successful pool insertion before releasing its write lock so a concurrent lookup cannot return the entry before its flag is set. Assisted-by: OpenAI Codex: model version unavailable
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Interned-state update and query crates/vm/src/intern.rs, crates/vm/src/stdlib/sys.rs |
The pool marks inserted strings as interned before releasing its write lock. The sys module adds sys._is_interned(string) to return a string object's interned state. |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Feature
Possibly related issues
- Upgrade Python libraries and test from Python 3.14 #6839: This change adds the
sys._is_interned()interface identified as part of the CPython 3.15 standard-library updates.
Possibly related PRs
- RustPython/RustPython#9242: The new function uses the positional argument binding behavior changed in this PR.
Suggested reviewers: youknowone
Merge Risk: 
Minimal · up to 6586b
-
The publication ordering and read-only query show no actionable merge-blocking issue. The change appears ready to merge subject to normal checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Comment @coderabbitai help to get the list of available commands.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
sys._is_interned()using the object's existing interned flag. The query does not intern its argument or mistake equal content (or immortality) for interning. It accepts string subclasses without coercion and takes one positional-only argument.The predicate follows CPython’s direct intern-state query; the pool-ordering change closes a RustPython-specific publication window.
This supplies a real prerequisite for the canonical Python 3.15 free-threading string tests, rather than adding a test-only helper or skip. Those tests are not included here: their package is tracked separately in #9428. No Lib modifications or xfail changes.
Validation
cargo checkand strictcargo clippy -- -D warningspassed with--no-default-features --features threading,stdlib,stdio,importlib,host_env,doc,ucd_3_2_0; bounded executable build passed.test.test_sys.SysModuleTest.test_intern: 1 passed.git diff --checkpassed.Generic argument-error wording still differs from CPython for missing/extra positional arguments and bytes/None inputs; the error types and rejection behavior match. No concurrent stress test or full workspace test run was performed, so these results do not prove general free-threading compatibility.
Build/runtime provenance and the immutable-source comparison were checked against a protected executable copy; runtime checks used disposable HOME/cwd and bounded time/memory. The existing test module's helper performs a finite loopback IPv6 capability probe; no external network connection was made.
Summary by CodeRabbit
sys._is_interned(string)to check whether a string is interned.