FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-148286: Run test_capi and test_faulthandler on GHA UBSan by vstinner · Pull Request #151274 · python/cpython · GitHub

Repository navigation

gh-148286: Run test_capi and test_faulthandler on GHA UBSan - #151274

Closed
vstinner wants to merge 1 commit into
python:mainfrom
vstinner:ubsan
Closed

vstinner wants to merge 1 commit into
python:mainfrom
vstinner:ubsan

Conversation

vstinner commented Jun 10, 2026 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

Copy link
Copy Markdown
Member Author

These 2 tests have been skipped by commit ade914b (PR gh-148168).

Copy link
Copy Markdown
Member Author

I cannot reproduce test_capi or test_faulthandler failure locally. I built Python with ./configure --with-pydebug --with-undefined-behavior-sanitizer CC=clang LD=clang:

$ UBSAN_OPTIONS='halt_on_error=1' ./python -m test -j0 test_capi test_faulthandler 
...
0:00:16 load avg: 0.69 mem: 61.4 MiB [1/2] test_faulthandler passed
0:00:23 load avg: 0.90 mem: 34.7 MiB [2/2] test_capi passed
...
All 2 tests OK.
...

Copy link
Copy Markdown
Member Author

Ah, the "Sanitizers / UBSan" CI failed:

  • 1 test failed: test_capi
  • The "Display logs" step contains many errors related to faulthandler

Copy link
Copy Markdown
Member Author

I rebuilt Python with CC=clang ./configure --config-cache --with-undefined-behavior-sanitizer --with-strict-overflow --with-pydebug && make clean && make.

Aha. This time I'm able to reproduce the error:

$ UBSAN_OPTIONS="halt_on_error=1" ./python -m test -v test_capi -m test_fromwidechar
test_fromwidechar (test.test_capi.test_unicode.CAPITest.test_fromwidechar)
Test PyUnicode_FromWideChar() ...

Objects/unicodeobject.c:1942:38: runtime error: addition of unsigned offset to 0x0000017b51d8 overflowed to 0x0000017b51d4
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Objects/unicodeobject.c:1942:38 

Copy link
Copy Markdown
Member Author

test_capi pass with this change:

diff --git a/Lib/test/test_capi/test_unicode.py b/Lib/test/test_capi/test_unicode.py
index 5dee25756fe..16ee04ba22b 100644
--- a/Lib/test/test_capi/test_unicode.py
+++ b/Lib/test/test_capi/test_unicode.py
@@ -842,9 +842,9 @@ 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(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.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)

Copy link
Copy Markdown
Member Author

I created #151278 to fix test_faulthandler. Once test_faulthandler will be fixed, I will create an issue to fix test_capi.

I close this PR since it's wrong. We cannot just reenable the tests since they fail.

vstinner closed this Jun 10, 2026
vstinner deleted the ubsan branch July 10, 2026 20:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL