[Python-checkins] bpo-46913: Skip test_ctypes.test_shorts() on UBSan (GH-31674)

vstinner webhook-mailer at python.org
Thu Mar 3 18:42:02 EST 2022


https://github.com/python/cpython/commit/ad1b04451d3aca2c6fa6dbe2891676a4e0baac49
commit: ad1b04451d3aca2c6fa6dbe2891676a4e0baac49
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2022-03-04T00:41:57+01:00
summary:

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.

files:
M Lib/ctypes/test/test_bitfields.py

diff --git a/Lib/ctypes/test/test_bitfields.py b/Lib/ctypes/test/test_bitfields.py
index 992b8c4da3a77..66acd62e6851a 100644
--- a/Lib/ctypes/test/test_bitfields.py
+++ b/Lib/ctypes/test/test_bitfields.py
@@ -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 @@ def test_ints(self):
                 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"



More information about the Python-checkins mailing list