Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Test that passing a non-string to sys.audit doesn't trigger an assert…
… in debug builds.
  • Loading branch information
devdanzin committed Oct 26, 2024
commit 620f682a980f9b5be3ae77dd645e48d172c85e02
9 changes: 9 additions & 0 deletions Lib/test/audit-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,15 @@ def hook(event, args):
_winapi.CreateNamedPipe(pipe_name, _winapi.PIPE_ACCESS_DUPLEX, 8, 2, 0, 0, 0, 0)


def test_assert_unicode():
import sys
sys.addaudithook(lambda *args: None)
try:
sys.audit(9)
except:
pass
Comment thread
devdanzin marked this conversation as resolved.
Comment thread
devdanzin marked this conversation as resolved.


if __name__ == "__main__":
from test.support import suppress_msvcrt_asserts

Expand Down
6 changes: 6 additions & 0 deletions Lib/test/test_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,5 +307,11 @@ def test_winapi_createnamedpipe(self):

self.assertEqual(actual, expected)

def test_assert_unicode(self):
returncode, events, stderr = self.run_python("test_assert_unicode")
Comment thread
devdanzin marked this conversation as resolved.
Outdated
Comment thread
picnixz marked this conversation as resolved.
Outdated
if returncode:
self.fail(stderr)


if __name__ == "__main__":
unittest.main()