mirror of
https://github.com/python/cpython.git
synced 2026-06-28 11:50:50 +00:00
[3.15] gh-151284: Fix test_capi on UBSan (GH-151286) (#151323)
gh-151284: Fix test_capi on UBSan (GH-151286)
Comment two checks relying on undefined behavior in
test_fromwidechar() of test_capi.
Enable test_capi in GitHub Action "Reusable Sanitizer".
(cherry picked from commit d87d772873)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
3603bd318b
commit
5caef8590a
2 changed files with 4 additions and 5 deletions
3
.github/workflows/reusable-san.yml
vendored
3
.github/workflows/reusable-san.yml
vendored
|
|
@ -82,13 +82,10 @@ jobs:
|
|||
run: make -j4
|
||||
- name: Display build info
|
||||
run: make pythoninfo
|
||||
# test_capi is skipped under UBSan because
|
||||
# they raise signals that UBSan with halt_on_error=1 intercepts.
|
||||
- name: Tests
|
||||
run: >-
|
||||
./python -m test
|
||||
${{ inputs.sanitizer == 'TSan' && '--tsan' || '' }}
|
||||
${{ inputs.sanitizer == 'UBSan' && '-x test_capi' || '' }}
|
||||
-j4 -W
|
||||
- name: Parallel tests
|
||||
if: >-
|
||||
|
|
|
|||
|
|
@ -842,9 +842,7 @@ def test_fromwidechar(self):
|
|||
if SIZEOF_WCHAR_T == 2:
|
||||
self.assertEqual(fromwidechar('a\U0001f600'.encode(encoding), 2), 'a\ud83d')
|
||||
|
||||
self.assertRaises(MemoryError, fromwidechar, b'', PY_SSIZE_T_MAX)
|
||||
self.assertRaises(SystemError, fromwidechar, b'\0'*SIZEOF_WCHAR_T, -2)
|
||||
self.assertRaises(SystemError, fromwidechar, b'\0'*SIZEOF_WCHAR_T, PY_SSIZE_T_MIN)
|
||||
self.assertEqual(fromwidechar(NULL, 0), '')
|
||||
self.assertRaises(SystemError, fromwidechar, NULL, 1)
|
||||
self.assertRaises(SystemError, fromwidechar, NULL, PY_SSIZE_T_MAX)
|
||||
|
|
@ -852,6 +850,10 @@ def test_fromwidechar(self):
|
|||
self.assertRaises(SystemError, fromwidechar, NULL, -2)
|
||||
self.assertRaises(SystemError, fromwidechar, NULL, PY_SSIZE_T_MIN)
|
||||
|
||||
# The following tests are skipped since they rely on undefined behavior
|
||||
#self.assertRaises(MemoryError, fromwidechar, b'', PY_SSIZE_T_MAX)
|
||||
#self.assertRaises(SystemError, fromwidechar, b'\0'*SIZEOF_WCHAR_T, PY_SSIZE_T_MIN)
|
||||
|
||||
@support.cpython_only
|
||||
@unittest.skipIf(_testlimitedcapi is None, 'need _testlimitedcapi module')
|
||||
def test_aswidechar(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue