-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Update netrc.py
from 3.13.6 and make pwd
accesible on Android
#6083
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
pub(crate) use pwd::make_module; | ||
|
||
#[allow(unused)] | ||
#[pymodule] | ||
mod pwd { | ||
Comment on lines
+5
to
7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Narrow the lint scope; avoid blanket allow(unused). Use a targeted allow only on Android or guard the specific import instead of silencing all unused warnings for the whole module. Suggested change: -#[allow(unused)]
+#[cfg_attr(target_os = "android", allow(unused_imports))] Additionally, consider guarding or moving the NonNull import so you can drop the allow entirely on Android: Option A (guard the import): #[cfg(not(target_os = "android"))]
use std::ptr::NonNull; Option B (move into the function and fully-qualify): // remove the module-level `use std::ptr::NonNull;`
// inside getpwall:
while let Some(ptr) = std::ptr::NonNull::new(unsafe { libc::getpwent() }) {
// ...
} This keeps clippy happy and avoids hiding unrelated issues. 🤖 Prompt for AI Agents
|
||
use crate::{ | ||
|
@@ -26,6 +27,7 @@ mod pwd { | |
pw_dir: String, | ||
pw_shell: String, | ||
} | ||
|
||
#[pyclass(with(PyStructSequence))] | ||
impl Passwd {} | ||
|
||
|
@@ -91,6 +93,7 @@ mod pwd { | |
} | ||
|
||
// TODO: maybe merge this functionality into nix? | ||
#[cfg(not(target_os = "android"))] | ||
#[pyfunction] | ||
fn getpwall(vm: &VirtualMachine) -> PyResult<Vec<PyObjectRef>> { | ||
// setpwent, getpwent, etc are not thread safe. Could use fgetpwent_r, but this is easier | ||
|
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.
Because the conditions in
stdlib/mod.rs
must be aligned, thisallow
will not be used.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.
it's only being used on android.
I can do what coderabbitai is suggesting if that's ok