Skip to content
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

Add os.fchdir builtin function #3017

Merged
merged 3 commits into from
Sep 7, 2021
Merged

Conversation

ChJR
Copy link
Contributor

@ChJR ChJR commented Sep 5, 2021

No description provided.

@@ -1268,6 1270,20 @@ mod _os {
env::set_current_dir(&path.path).map_err(|err| err.into_pyexception(vm))
}

#[cfg(not(windows))]
#[pyfunction]
fn fchdir(fd: PyIntRef, vm: &VirtualMachine) -> PyResult<()> {
Copy link
Member

Choose a reason for hiding this comment

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

this function need to be place in posix module. (try import posix; posix.fchdir in CPython) Then it will be automatically imported in os module. Then #[cfg(not(windows))]` is also not required anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a great point! I'll push the refined one.

@youknowone youknowone merged commit 14405b7 into RustPython:main Sep 7, 2021
@ChJR ChJR deleted the feature/os.fchdir branch September 7, 2021 16:32
@youknowone youknowone added the z-ca-2021 Tag to track contrubution-academy 2021 label Oct 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
z-ca-2021 Tag to track contrubution-academy 2021
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants