Skip to content

disable pylint W1509 subprocess-popen-preexec-fn#5

Merged
nickdesaulniers merged 1 commit into
mainfrom
subprocess-popen-preexec-fn
Dec 16, 2022
Merged

disable pylint W1509 subprocess-popen-preexec-fn#5
nickdesaulniers merged 1 commit into
mainfrom
subprocess-popen-preexec-fn

Conversation

@nickdesaulniers

Copy link
Copy Markdown
Member

I'm not sure how to work around

boot-qemu.py:768:17: W1509: Using preexec_fn keyword which may be unsafe in the presence of threads (subprocess-popen-preexec-fn)

For python 3.10.8. I might be able to use process_group=1 in the subprocess.Popen constructor, but seems it's only available in python 3.11+.

Link: ClangBuiltLinux/boot-utils#87

I'm not sure how to work around

  boot-qemu.py:768:17: W1509: Using preexec_fn keyword which may be unsafe in the presence of threads (subprocess-popen-preexec-fn)

For python 3.10.8.  I might be able to use process_group=1 in the
subprocess.Popen constructor, but seems it's only available in python
3.11+.

Link: ClangBuiltLinux/boot-utils#87

@nathanchance nathanchance left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I do not really have a strong opinion on this vs. just disabling it locally with a # pylint: disable-next=subprocess-popen-preexec-fn. It seems unlikely that we will ever use another preexec_fn argument again but who knows...

@nickdesaulniers nickdesaulniers merged commit aa6b0e7 into main Dec 16, 2022
@nickdesaulniers nickdesaulniers deleted the subprocess-popen-preexec-fn branch December 16, 2022 21:54
nickdesaulniers added a commit to ClangBuiltLinux/boot-utils that referenced this pull request Dec 16, 2022
nathanchance added a commit to nathanchance/boot-utils that referenced this pull request Aug 18, 2023
This is the same warning from pylint that was disabled in
ClangBuiltLinux/actions-workflows#5.

  boot-qemu.py:216:35: PLW1509 `preexec_fn` argument is unsafe when using threads

'preexec_fn' is on the path towards deprecation, so workaround this
warning by refactoring the code to use the new keyword argument
'process_group' when using Python 3.11 and newer, which makes it clear
that we don't need 'preexec_fn' longterm. This conveniently hides the
'preexec_fn' use in Popen() so there is no more warning.

Link: https://beta.ruff.rs/docs/rules/subprocess-popen-preexec-fn/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
nathanchance added a commit to nathanchance/boot-utils that referenced this pull request Aug 18, 2023
This is the same warning from pylint that was disabled in
ClangBuiltLinux/actions-workflows#5.

  boot-qemu.py:216:35: PLW1509 `preexec_fn` argument is unsafe when using threads

'preexec_fn' is on the path towards deprecation, so workaround this
warning by refactoring the code to use the new keyword argument
'process_group' when using Python 3.11 and newer, which makes it clear
that we don't need 'preexec_fn' longterm. This conveniently hides the
'preexec_fn' use in Popen() so there is no more warning.

Link: https://beta.ruff.rs/docs/rules/subprocess-popen-preexec-fn/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
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.

2 participants