Skip to content

Add errno.EHWPOISON#7996

Open
ShaharNaveh wants to merge 1 commit into
RustPython:mainfrom
ShaharNaveh:errno-EHWPOISON
Open

Add errno.EHWPOISON#7996
ShaharNaveh wants to merge 1 commit into
RustPython:mainfrom
ShaharNaveh:errno-EHWPOISON

Conversation

@ShaharNaveh
Copy link
Copy Markdown
Contributor

@ShaharNaveh ShaharNaveh commented May 30, 2026

Summary

Summary by CodeRabbit

  • Improvements
    • Added support for hardware poison error (EHWPOISON) recognition and reporting on select Unix-based systems, including Linux and Fuchsia.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 30, 2026

📝 Walkthrough

Walkthrough

This pull request adds conditional support for the EHWPOISON error code constant to RustPython's errno module. The constant is guarded by platform-specific compilation flags targeting Unix-based systems with Linux or Fuchsia kernels, while explicitly excluding FreeBSD, Android, and Apple platforms.

Changes

EHWPOISON Error Code Addition

Layer / File(s) Summary
EHWPOISON constant with platform gating
crates/vm/src/stdlib/errno.rs
Adds EHWPOISON error code constant to the ERROR_CODES dictionary with nested cfg attributes that restrict compilation to unix targets running Linux or Fuchsia, excluding FreeBSD, Android, and Apple vendors.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A poison most electric found its way,
Through Unix gates, on Linux it shall stay,
With Fuchsia as friend, but Apple must decline,
One constant small, yet perfectly aligned! ⚡

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add errno.EHWPOISON' directly and accurately summarizes the main change: adding support for the EHWPOISON errno constant to the errno module.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown
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.

🧹 Nitpick comments (1)
crates/vm/src/stdlib/errno.rs (1)

736-747: ⚡ Quick win

Remove redundant target_os = "freebsd" exclusion.

The not(any(target_os = "freebsd", ...)) clause includes target_os = "freebsd", but this is already excluded by the positive condition any(target_os = "linux", target_os = "fuchsia"). A target cannot simultaneously be both Linux/Fuchsia and FreeBSD.

♻️ Simplified cfg condition
 e!(
     cfg(all(
         unix,
         any(target_os = "linux", target_os = "fuchsia"),
         not(any(
-            target_os = "freebsd",
             target_os = "android",
             target_vendor = "apple",
         ))
     )),
     EHWPOISON
 ),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/vm/src/stdlib/errno.rs` around lines 736 - 747, The cfg expression
used for the EHWPOISON entry contains a redundant exclusion "target_os =
\"freebsd\"" inside the not(any(...)) list; remove that redundancy by deleting
the `target_os = "freebsd"` item from the not(any(...)) clause so the e!(...)
invocation that defines EHWPOISON uses cfg(all(unix, any(target_os = "linux",
target_os = "fuchsia"), not(any(target_os = "android", target_vendor =
"apple")))) instead—update the e! macro usage referencing EHWPOISON in errno.rs
accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@crates/vm/src/stdlib/errno.rs`:
- Around line 736-747: The cfg expression used for the EHWPOISON entry contains
a redundant exclusion "target_os = \"freebsd\"" inside the not(any(...)) list;
remove that redundancy by deleting the `target_os = "freebsd"` item from the
not(any(...)) clause so the e!(...) invocation that defines EHWPOISON uses
cfg(all(unix, any(target_os = "linux", target_os = "fuchsia"), not(any(target_os
= "android", target_vendor = "apple")))) instead—update the e! macro usage
referencing EHWPOISON in errno.rs accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: d176aad6-2650-43cf-b3dc-f169d02f2776

📥 Commits

Reviewing files that changed from the base of the PR and between 26f817a and 190f52a.

📒 Files selected for processing (1)
  • crates/vm/src/stdlib/errno.rs

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