Repository navigation
gh-159237: Fix buffer type confusion in _winapi.CreateProcess audit event - #159238
Merged
Merged
Conversation
vstinner
reviewed
Dec 4, 2026
vstinner
left a comment
Member
There was a problem hiding this comment.
It would be nice to wait until the child process completes. Can you apply this patch?
diff --git a/Lib/test/audit-tests.py b/Lib/test/audit-tests.py
index 275555cefbb..235b7330ff9 100644
--- a/Lib/test/audit-tests.py
+++ b/Lib/test/audit-tests.py
@@ -9,6 +9,7 @@
import os
import sys
import unittest.mock
+from test import support
from test.support import swap_item
@@ -668,11 +669,18 @@ def hook(event, args):
print(event, args)
sys.addaudithook(hook)
+
hp, ht, _, _ = _winapi.CreateProcess(
sys.executable, command_line, None, None, False, 0, None, None,
subprocess.STARTUPINFO())
_winapi.CloseHandle(ht)
+
+ timeout = support.SHORT_TIMEOUT
+ timeout = int(timeout * 1000)
+ result = _winapi.WaitForSingleObject(hp, timeout)
_winapi.CloseHandle(hp)
+ if result == _winapi.WAIT_TIMEOUT:
+ raise TimeoutError(f"process still running after {timeout} ms")
def test_assert_unicode():Co-authored-by: Victor Stinner <vstinner@python.org>
Member
Author
|
@vstinner Applied! |
|
Sorry, @aisk and @vstinner, I could not cleanly backport this to Please backport manually with cherry_picker, see the devguide for more information. |
|
GH-163158 is a backport of this pull request to the 3.15 branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_winapi.CreateProcessaudit event passes garbage forcommand_line#159237