]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46913: Skip test_ctypes.test_shorts() on UBSan (GH-31674)
authorVictor Stinner <vstinner@python.org>
Thu, 3 Mar 2022 23:41:57 +0000 (00:41 +0100)
committerGitHub <noreply@github.com>
Thu, 3 Mar 2022 23:41:57 +0000 (00:41 +0100)
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.

Lib/ctypes/test/test_bitfields.py

index 992b8c4da3a7767ef33acca80d86203a8b066356..66acd62e6851a12e1a7d4b34f9f3b083e3fa9a0d 100644 (file)
@@ -1,5 +1,6 @@
 from ctypes import *
 from ctypes.test import need_symbol
+from test import support
 import unittest
 import os
 
@@ -39,6 +40,8 @@ class C_Test(unittest.TestCase):
                 setattr(b, name, i)
                 self.assertEqual(getattr(b, name), func(byref(b), name.encode('ascii')))
 
+    # bpo-46913: _ctypes/cfield.c h_get() has an undefined behavior
+    @support.skip_if_sanitizer(ub=True)
     def test_shorts(self):
         b = BITS()
         name = "M"