Skip to content

Conversation

@youknowone
Copy link
Member

@youknowone youknowone commented Jan 18, 2026

Summary by CodeRabbit

  • New Features

    • Added a system-level function to query remote debugging availability (returns false).
    • Exposed an implementation flag indicating isolated interpreter support (set to false).
  • Refactor

    • Internal declaration layout for ABI flags was reorganized (no behavioral change).

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 18, 2026

📝 Walkthrough

Walkthrough

Added a new sys-level function is_remote_debug_enabled() (always false), introduced an internal ABIFLAGS_ATTR constant while keeping ABIFLAGS exported, and added "supports_isolated_interpreters": false to the sys.implementation namespace in two construction sites.

Changes

Cohort / File(s) Summary
Sys module: API & constants
crates/vm/src/stdlib/sys.rs
Added internal ABIFLAGS_ATTR: &str = "t"; retained pub(crate) ABIFLAGS: &str = "t" with adjusted declaration layout.
Sys module: runtime flags
crates/vm/src/stdlib/sys.rs
Added const fn is_remote_debug_enabled() -> bool (PyFunction) returning false.
Sys module: implementation namespace
crates/vm/src/stdlib/sys.rs
Inserted "supports_isolated_interpreters" => ctx.new_bool(false) into both sys.implementation namespace constructions (duplicate presence).

Sequence Diagram(s)

(Skipped — changes are small API/flag additions without multi-component control flow.)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Update test_sys.py from 3.13.11 #6428 — Adds similar sys-level boolean-returning function(s) (e.g., _is_gil_enabled), touching the same crates/vm/src/stdlib/sys.rs area; likely related API work.

Poem

🐰 Hippity-hop, a flag and a name,
False for remote, the rabbit proclaims.
ABIFLAGS tucked in a quieter place,
Isolated interpreters kept out of the race.
Tiny change, big cheer—snack time, hooray! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'update test_sys from 3.14.2' is vague and does not clearly communicate the main changes made to the sys module, which include adding is_remote_debug_enabled(), supports_isolated_interpreters flag, and ABIFLAGS reorganization. Consider revising the title to be more specific about the actual changes, such as 'Add is_remote_debug_enabled() and supports_isolated_interpreters to sys module' or similar descriptive language that clarifies the primary modifications.
✅ 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%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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.

@youknowone youknowone marked this pull request as ready for review January 18, 2026 13:26
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@crates/vm/src/stdlib/sys.rs`:
- Around line 632-636: The function is_remote_debug_enabled() is not part of
CPython 3.14 public API, so either remove it or make it explicitly a RustPython
extension: if this was accidental, delete the const fn is_remote_debug_enabled
and its #[pyfunction] entry from sys.rs; if intentional, rename it to a
RustPython-specific symbol (e.g., _rustpython_is_remote_debug_enabled or keep
the Rust name but add a distinct Python name via #[pyfunction(name =
"_rustpython_is_remote_debug_enabled")]), add a doc comment stating it is a
RustPython extension, and gate it behind a feature flag (e.g., #[cfg(feature =
"rustpython_ext")]) so it does not pretend to be the CPython API.

Comment on lines +632 to +639
/// Return True if remote debugging is enabled, False otherwise.
#[pyfunction]
const fn is_remote_debug_enabled() -> bool {
false // RustPython does not support remote debugging
}
Copy link
Contributor

@coderabbitai coderabbitai bot Jan 18, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

cd crates/vm/src/stdlib && head -c 30000 sys.rs | tail -c 5000 | cat -n

Repository: RustPython/RustPython

Length of output: 5912


🏁 Script executed:

sed -n '625,640p' crates/vm/src/stdlib/sys.rs

Repository: RustPython/RustPython

Length of output: 550


🏁 Script executed:

sed -n '620,640p' crates/vm/src/stdlib/sys.rs

Repository: RustPython/RustPython

Length of output: 649


🌐 Web query:

Python 3.14 sys.is_remote_debug_enabled documentation official API

💡 Result:

Short answer: There is no official sys.is_remote_debug_enabled API in Python 3.14. The documented remote-debugging APIs are sys.remote_exec() and the PEP 768 / remote-debugging configuration flags (PYTHON_DISABLE_REMOTE_DEBUG, -X disable-remote-debug, --without-remote-debug). See the official sys docs and PEP for details. [1][2][3]

Sources:

  • sys module (3.14) — sys.remote_exec(). [1]
  • PEP 768 — Safe external debugger interface (configuration, debug-offset flag). [2]
  • Python 3.14 remote debugging how-to (attachment protocol / implementation notes). [3]

Function does not match Python 3.14's documented API

While the implementation correctly follows the established pattern used by similar stub functions like _is_gil_enabled(), the sys.is_remote_debug_enabled() function does not exist in Python 3.14's documented public API. Python 3.14's remote debugging support is provided through sys.remote_exec() and configuration flags (PEP 768), not an is_remote_debug_enabled() function.

Clarify whether this is intentional (adding a RustPython-specific extension) or if the function should be removed or renamed to match CPython's actual API.

🤖 Prompt for AI Agents
In `@crates/vm/src/stdlib/sys.rs` around lines 632 - 636, The function
is_remote_debug_enabled() is not part of CPython 3.14 public API, so either
remove it or make it explicitly a RustPython extension: if this was accidental,
delete the const fn is_remote_debug_enabled and its #[pyfunction] entry from
sys.rs; if intentional, rename it to a RustPython-specific symbol (e.g.,
_rustpython_is_remote_debug_enabled or keep the Rust name but add a distinct
Python name via #[pyfunction(name = "_rustpython_is_remote_debug_enabled")]),
add a doc comment stating it is a RustPython extension, and gate it behind a
feature flag (e.g., #[cfg(feature = "rustpython_ext")]) so it does not pretend
to be the CPython API.

Copy link
Member Author

Choose a reason for hiding this comment

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

you are wrong

Copy link
Contributor

Choose a reason for hiding this comment

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

🧩 Analysis chain

🌐 Web query:

Python 3.14 sys.is_remote_debug_enabled official documentation

💡 Result:

Short answer: There is no entry for sys.is_remote_debug_enabled in the official Python 3.14 library documentation — it appears in CPython source (sysmodule.c) as an internal/CPython-only symbol but is not documented as a public sys.* API. Evidence:

  • Official sys module docs for 3.14 (no is_remote_debug_enabled entry; documents sys.remote_exec and the remote-debugging feature). [1]
  • CPython source listing showing SYS_IS_REMOTE_DEBUG_ENABLED in Python/sysmodule.c. [2]
  • Python 3.14 remote-debugging howto / PEP 768 describing the feature added in 3.14. [3]

References

  1. sys — System-specific parameters and functions — Python 3.14.2 documentation. [docs.python.org/library/sys.html]
  2. CPython 3.14 sysmodule.c (symbol SYS_IS_REMOTE_DEBUG_ENABLED). [fossies.org / Python-3.14.0rc1/Python/sysmodule.c]
  3. Remote debugging attachment protocol / PEP 768 — Python 3.14 docs. [docs.python.org/howto/remote_debugging.html; whatsnew 3.14]

🌐 Web query:

CPython 3.14 SYS_IS_REMOTE_DEBUG_ENABLED callable Python function

💡 Result:

Short answer: There is no Python-callable function named SYS_IS_REMOTE_DEBUG_ENABLED in CPython 3.14. The remote-debug feature is exposed as sys.remote_exec(...) and via build/runtime flags (PYTHON_DISABLE_REMOTE_DEBUG, -X disable-remote-debug, --without-remote-debug) and a debug-offsets flag in the runtime for external tools to inspect. See PEP 768 and the sys / remote-debugging docs. [1][2]

Sources:

  • PEP 768 (Safe external debugger interface). [1]
  • Python 3.14 sys module and remote-debugging howto (sys.remote_exec and runtime/config flags). [2]

🌐 Web query:

CPython 3.14 sysmodule.c "is_remote_debug_enabled" method definition

💡 Result:

CPython 3.14 exposes sys.is_remote_debug_enabled() (returns bool). The public docs and typeshed stub show the API; the remote-debugging implementation is in the remote debugging sources (Python/remote_debugging.c and Modules/_remote_debugging_module.c) introduced for PEP 768. See:

  • sys.is_remote_debug_enabled() in typeshed (stub showing signature and docstring). [1]
  • Python 3.14 sys module docs mentioning remote debugging and related sys.remote_exec(). [2]
  • CPython work implementing PEP 768 (remote debugging sources live in Python/remote_debugging.c and Modules/_remote_debugging_module.c in the cpython repo). [3]

If you want the exact C definition (function name, parameters, and body) I can fetch the specific source file and paste the implementation lines for you — shall I do that?

Sources:
[1] fossies/typeshed sys stub (is_remote_debug_enabled).
[2] Python 3.14 sys library docs (remote_exec / remote debug configure).
[3] CPython PEP 768 / remote-debugging implementation files (Python/remote_debugging.c, Modules/_remote_debugging_module.c).


@youknowone, you're absolutely right, and I apologize for the incorrect review comment.

sys.is_remote_debug_enabled() is indeed a valid Python 3.14 API. It's part of the remote debugging functionality introduced in PEP 768, and the function is properly exposed in CPython 3.14 (as confirmed by the typeshed stubs and implementation in the CPython source).

Your implementation correctly follows the pattern of other stub functions and appropriately returns false since RustPython doesn't support remote debugging. The addition is correct for matching Python 3.14.2's API.

Thank you for the correction!


🧠 Learnings used
Learnt from: moreal
Repo: RustPython/RustPython PR: 5847
File: vm/src/stdlib/stat.rs:547-567
Timestamp: 2025-06-27T14:47:28.810Z
Learning: In RustPython's stat module implementation, platform-specific constants like SF_SUPPORTED and SF_SYNTHETIC should be conditionally declared only for the platforms where they're available (e.g., macOS), following CPython's approach of optional declaration using `#ifdef` checks rather than providing fallback values for other platforms.

@youknowone youknowone merged commit 3a9f020 into RustPython:main Jan 18, 2026
13 checks passed
@youknowone youknowone deleted the sys branch January 18, 2026 14:58
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