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

Implimenting os ctermid #2401

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AthulMuralidhar
Copy link

@AthulMuralidhar AthulMuralidhar commented Jan 17, 2021

Description

  • the main issue is here: Extend the os module #1175
  • I am trying to impliment ctermid first - so that i can try to understand the rust python compiler
  • Please let me know if this one works

@AthulMuralidhar
Copy link
Author

Hey @coolreader18 could you please let me know if my approach is right?

@coolreader18
Copy link
Member

It doesn't look like libc has ctermid -- rust-lang/libc#1928. However, you can just define it inline, as:

extern "C" {
    fn ctermid(s: *mut libc::c_char) -> *mut libc::c_char;
}

Also, you have to pass std::ptr::null_mut() as the argument, and you should put the function at the end of the mod posix instead of the mod nt as you've done.

@AthulMuralidhar
Copy link
Author

should I inline it within the function itself or is it ok as is?

@AthulMuralidhar AthulMuralidhar force-pushed the implimenting-os-ctermid-fechdir branch 2 times, most recently from 6bf2f0f to 829b892 Compare February 17, 2021 15:01
vm/src/stdlib/os.rs Outdated Show resolved Hide resolved
@AthulMuralidhar AthulMuralidhar marked this pull request as ready for review April 7, 2021 16:04
@youknowone youknowone force-pushed the implimenting-os-ctermid-fechdir branch from 711e4ca to 41a680d Compare August 17, 2021 14:23
vm/src/stdlib/os.rs Outdated Show resolved Hide resolved
@youknowone
Copy link
Member

I checked macos python 3.9 and linux 3.6 but cannot find os._ctermid
where is it expected to be defined?

@AthulMuralidhar
Copy link
Author

where is it expected to be defined?

I dont really understand you comment :/ maybe please explain a little more? If you were referring to the function name, it was indeed named _ctermid now changed it back to ctermid with some refactoring

@youknowone
Copy link
Member

youknowone commented Aug 21, 2021

I expect this PR has just 1 commit. Any PR shouldn't contain a merge commit. Rebase or cherry-pick your work onto upstream/master please.
When I rebased your works, I made them into a single commit. You can attach your work onto that one.

@AthulMuralidhar AthulMuralidhar changed the title Implimenting os ctermid fechdir Implimenting os ctermid Sep 6, 2021
@AthulMuralidhar
Copy link
Author

Note for the reviewers: i saw another pr(#3017) for fcdir so removed the code here

@youknowone youknowone force-pushed the implimenting-os-ctermid-fechdir branch from c057f5e to ee19708 Compare August 4, 2022 19:15
Copy link
Member

@youknowone youknowone left a comment

Choose a reason for hiding this comment

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

no #[pyfunction] means never tested

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.

None yet

4 participants