-
Notifications
You must be signed in to change notification settings - Fork 1.4k
update test_sys from 3.14.2 #6781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughAdded a new sys-level function Changes
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
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
There was a problem hiding this 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.
| /// Return True if remote debugging is enabled, False otherwise. | ||
| #[pyfunction] | ||
| const fn is_remote_debug_enabled() -> bool { | ||
| false // RustPython does not support remote debugging | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
cd crates/vm/src/stdlib && head -c 30000 sys.rs | tail -c 5000 | cat -nRepository: RustPython/RustPython
Length of output: 5912
🏁 Script executed:
sed -n '625,640p' crates/vm/src/stdlib/sys.rsRepository: RustPython/RustPython
Length of output: 550
🏁 Script executed:
sed -n '620,640p' crates/vm/src/stdlib/sys.rsRepository: 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are wrong
There was a problem hiding this comment.
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
- sys — System-specific parameters and functions — Python 3.14.2 documentation. [docs.python.org/library/sys.html]
- CPython 3.14 sysmodule.c (symbol SYS_IS_REMOTE_DEBUG_ENABLED). [fossies.org / Python-3.14.0rc1/Python/sysmodule.c]
- 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.
Summary by CodeRabbit
New Features
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.