Skip to content

Commit ad1b044

Browse files
authored
bpo-46913: Skip test_ctypes.test_shorts() on UBSan (GH-31674)
If Python is built with UBSan, test_ctypes now skips test_shorts(). This change allows to run test_ctypes to check for new UBSan regression, but the known test_shorts() undefined behavior must be fixed.
1 parent 6d0d7d2 commit ad1b044

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Lib/ctypes/test/test_bitfields.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from ctypes import *
22
from ctypes.test import need_symbol
3+
from test import support
34
import unittest
45
import os
56

@@ -39,6 +40,8 @@ def test_ints(self):
3940
setattr(b, name, i)
4041
self.assertEqual(getattr(b, name), func(byref(b), name.encode('ascii')))
4142

43+
# bpo-46913: _ctypes/cfield.c h_get() has an undefined behavior
44+
@support.skip_if_sanitizer(ub=True)
4245
def test_shorts(self):
4346
b = BITS()
4447
name = "M"

0 commit comments

Comments
 (0)