-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
bpo-31884 subprocess set priority on windows #4150
Changes from 12 commits
22206b9
788a086
f47ce08
a7e78e4
0b3e805
bdaf817
f972658
55ace15
13f0893
382f890
197861f
2ccf787
680efd7
5114f8c
8d3fac6
264fb12
0765c90
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 |
---|---|---|
|
@@ -516,8 +516,20 @@ functions. | |
|
||
If given, *startupinfo* will be a :class:`STARTUPINFO` object, which is | ||
passed to the underlying ``CreateProcess`` function. | ||
*creationflags*, if given, can be :data:`CREATE_NEW_CONSOLE` or | ||
:data:`CREATE_NEW_PROCESS_GROUP`. (Windows only) | ||
*creationflags*, if given, can be | ||
:data:`CREATE_NEW_CONSOLE` | ||
:data:`CREATE_NEW_PROCESS_GROUP` | ||
:data:`ABOVE_NORMAL_PRIORITY_CLASS` | ||
:data:`BELOW_NORMAL_PRIORITY_CLASS` | ||
:data:`HIGH_PRIORITY_CLASS` | ||
:data:`IDLE_PRIORITY_CLASS` | ||
:data:`NORMAL_PRIORITY_CLASS` | ||
:data:`REALTIME_PRIORITY_CLASS` | ||
:data:`CREATE_NO_WINDOW` | ||
:data:`DETACHED_PROCESS` | ||
:data:`CREATE_DEFAULT_ERROR_MODE` | ||
:data:`CREATE_BREAKAWAY_FROM_JOB` | ||
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. I'm not sure about this "versioadded" section. I suggest to remove it. |
||
|
||
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. A single empty line is enough at the end of this list. |
||
|
||
Popen objects are supported as context managers via the :keyword:`with` statement: | ||
on exit, standard file descriptors are closed, and the process is waited for. | ||
|
@@ -839,18 +851,87 @@ The :mod:`subprocess` module exposes the following constants. | |
additional information. | ||
|
||
.. data:: CREATE_NEW_CONSOLE | ||
|
||
The new process has a new console, instead of inheriting its parent's | ||
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. The title of the current section is " Constants". I checked: all constants documented here as specific to Windows. I propose to rename the section to "Windows Constants". Can you please do that? |
||
console (the default). | ||
|
||
.. data:: CREATE_NEW_PROCESS_GROUP | ||
|
||
|
||
.. versionadded:: 3.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. This change seems wrong: this constant was already available on Python 3.6. |
||
A :class:`Popen` ``creationflags`` parameter to specify that a new process | ||
group will be created. This flag is necessary for using :func:`os.kill` | ||
on the subprocess. | ||
|
||
This flag is ignored if :data:`CREATE_NEW_CONSOLE` is specified. | ||
|
||
|
||
.. data:: ABOVE_NORMAL_PRIORITY_CLASS | ||
|
||
.. versionadded:: 3.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. The versionadded markup is usually added after the text, and surrounded by an empty line (above and after). |
||
A :class:`Popen` ``creationflags`` parameter to specify that a new process | ||
will have an above average priority. | ||
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. You have to add ".. versionadded:: 3.7" here: same for each added constant below. |
||
|
||
.. data:: BELOW_NORMAL_PRIORITY_CLASS | ||
|
||
.. versionadded:: 3.7 | ||
A :class:`Popen` ``creationflags`` parameter to specify that a new process | ||
will have a below average priority. | ||
|
||
.. data:: HIGH_PRIORITY_CLASS | ||
|
||
.. versionadded:: 3.7 | ||
A :class:`Popen` ``creationflags`` parameter to specify that a new process | ||
will have a high priority. | ||
|
||
.. data:: IDLE_PRIORITY_CLASS | ||
|
||
.. versionadded:: 3.7 | ||
A :class:`Popen` ``creationflags`` parameter to specify that a new process | ||
will have an idle (lowest) priority. | ||
|
||
.. data:: NORMAL_PRIORITY_CLASS | ||
|
||
.. versionadded:: 3.7 | ||
A :class:`Popen` ``creationflags`` parameter to specify that a new process | ||
will have an normal priority. (default) | ||
|
||
.. data:: REALTIME_PRIORITY_CLASS | ||
|
||
.. versionadded:: 3.7 | ||
A :class:`Popen` ``creationflags`` parameter to specify that a new process | ||
will have realtime priority. | ||
You should almost never use REALTIME_PRIORITY_CLASS, because this interrupts | ||
system threads that manage mouse input, keyboard input, and background disk | ||
flushing. This class can be appropriate for applications that "talk" directly | ||
to hardware or that perform brief tasks that should have limited interruptions. | ||
|
||
.. data:: CREATE_NO_WINDOW | ||
|
||
.. versionadded:: 3.7 | ||
A :class:`Popen` ``creationflags`` parameter to specify that a new process | ||
will not create a window | ||
|
||
.. data:: DETACHED_PROCESS | ||
|
||
.. versionadded:: 3.7 | ||
A :class:`Popen` ``creationflags`` parameter to specify that a new process | ||
will not inherit its parent's console. | ||
This value cannot be used with CREATE_NEW_CONSOLE. | ||
|
||
.. data:: CREATE_DEFAULT_ERROR_MODE | ||
|
||
.. versionadded:: 3.7 | ||
A :class:`Popen` ``creationflags`` parameter to specify that a new process | ||
does not inherit the error mode of the calling process. Instead, the new | ||
process gets the default error mode. | ||
This feature is particularly useful for multithreaded shell applications | ||
that run with hard errors disabled. | ||
|
||
.. data:: CREATE_BREAKAWAY_FROM_JOB | ||
|
||
.. versionadded:: 3.7 | ||
A :class:`Popen` ``creationflags`` parameter to specify that a new process | ||
is not associated with the job. | ||
|
||
.. _call-function-trio: | ||
|
||
Older high-level API | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
added required constants to subprocess module for setting priotity on windows |
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.
This change seems unrelated and I preferred the previous formatting.
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.
i'm not sure how this is unrelated? this shows where the added constants should 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.
Ah, when I wrote my comment, the doc was formatted differently.
Ok, now I suggest to format these constants as a list:
(correctly indented for the current section)
Try to build the documentation to see how it's rendered in HTML. On Unix, it's "make -C Doc html". I don't know how to build it on Windows :-(
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.
unfortunately i don't currently have access to a unix box (windows 10 broke my dual boot) and currently on a work pc so don't even have git client, doing this through the web interface... so i can't build the docs to see how they look
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.
I checked in MSDN: in fact, you can specify multiple flags at once:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms686331(v=vs.85).aspx
dwFlags: "A bitfield that determines whether certain STARTUPINFO members are used when the process creates a window. This member can be one or more of the following values."
By the way, please add a column after "can be" ("can be:"), and an empty line after.
I propose: "can be one or more of the following flags:".