From e27d96bc8d5992558b0e4405c5408fb351d92280 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 4 Mar 2022 00:19:23 +0100 Subject: [PATCH] bpo-46913: Skip test_ctypes.test_shorts() on UBSan If Python is built with UBSan, test_ctypes now skips test_shorts(). This change allows to run test_ctypes to check for UBSan regression, but the test_shorts() undefined behavior must be fixed. --- Lib/ctypes/test/test_bitfields.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/ctypes/test/test_bitfields.py b/Lib/ctypes/test/test_bitfields.py index 992b8c4da3a7767..66acd62e6851a12 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"