Skip to content

Commit 72de4e6

Browse files
committed
gh-151284: Fix test_capi on UBSan
Remove two checks relying on undefined behavior in test_fromwidechar() of test_capi. Enable test_capi in GitHub Action "Reusable Sanitizer".
1 parent e60c42d commit 72de4e6

2 files changed

Lines changed: 0 additions & 5 deletions

File tree

.github/workflows/reusable-san.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,10 @@ jobs:
8282
run: make -j4
8383
- name: Display build info
8484
run: make pythoninfo
85-
# test_capi is skipped under UBSan because
86-
# they raise signals that UBSan with halt_on_error=1 intercepts.
8785
- name: Tests
8886
run: >-
8987
./python -m test
9088
${{ inputs.sanitizer == 'TSan' && '--tsan' || '' }}
91-
${{ inputs.sanitizer == 'UBSan' && '-x test_capi' || '' }}
9289
-j4 -W
9390
- name: Parallel tests
9491
if: >-

Lib/test/test_capi/test_unicode.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,9 +842,7 @@ def test_fromwidechar(self):
842842
if SIZEOF_WCHAR_T == 2:
843843
self.assertEqual(fromwidechar('a\U0001f600'.encode(encoding), 2), 'a\ud83d')
844844

845-
self.assertRaises(MemoryError, fromwidechar, b'', PY_SSIZE_T_MAX)
846845
self.assertRaises(SystemError, fromwidechar, b'\0'*SIZEOF_WCHAR_T, -2)
847-
self.assertRaises(SystemError, fromwidechar, b'\0'*SIZEOF_WCHAR_T, PY_SSIZE_T_MIN)
848846
self.assertEqual(fromwidechar(NULL, 0), '')
849847
self.assertRaises(SystemError, fromwidechar, NULL, 1)
850848
self.assertRaises(SystemError, fromwidechar, NULL, PY_SSIZE_T_MAX)

0 commit comments

Comments
 (0)