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

os: implement os.nice #2935

Merged
merged 1 commit into from Aug 25, 2021
Merged

os: implement os.nice #2935

merged 1 commit into from Aug 25, 2021

Conversation

@zetwhite
Copy link
Contributor

@zetwhite zetwhite commented Aug 22, 2021

this implements os.nice (which linked to a unix system call, changing process priority) function.

with this commit, rustpyhton works as below.

>>>>> import os
>>>>> os.nice(0)
0
>>>>> os.nice(-1)
-1
>>>>> os.nice(-10)
-11
>>>>> os.nice(10)
-1
>>>>> os.nice(20)
19
>>>>> os.nice(20)
19
>>>>> os.nice(-20)
-1
>>>>> os.nice(-12)
-13
>>>>> os.nice(-100)
-20
@zetwhite zetwhite force-pushed the master branch 3 times, most recently from 6ce9633 to 436dece Aug 22, 2021
Copy link
Member

@youknowone youknowone left a comment

nice function is defined in posix module rather than os itself. Please move this funciton to posix module in the same file. (Search for mod posix {)
Then os module will import it from posix automatically. Becasue posix module is defined only for unix, you don't need to add #[cfg(unix)] then.

@zetwhite zetwhite force-pushed the master branch 2 times, most recently from 264079b to 2f08be5 Aug 24, 2021
@zetwhite
Copy link
Contributor Author

@zetwhite zetwhite commented Aug 24, 2021

Thank you for your kind comment!
I changed as you mentioned. please check it out.

@youknowone youknowone merged commit d7bacf0 into RustPython:main Aug 25, 2021
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants