GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-148286: Run test_capi and test_faulthandler on GHA UBSan by vstinner · Pull Request #151274 · python/cpython

Conversation

@vstinner

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

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: Various UB warnings found by UBSan #148286

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner
pythongh-148286: Run test_capi and test_faulthandler on GHA UBSan
08b3544
@vstinner vstinner added the skip news label Jun 10, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Jun 10, 2026
Various UB warnings found by UBSan #148286
Open
@vstinner

vstinner commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Jun 10, 2026

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.
...
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Jun 10, 2026

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
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Jun 10, 2026

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 
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Jun 10, 2026

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)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Jun 10, 2026

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner closed this Jun 10, 2026
@vstinner vstinner mentioned this pull request Jun 10, 2026
Fix test_faulthandler on UBSan #151278
Closed
@vstinner
vstinner deleted the ubsan branch July 10, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ezio-melotti ezio-melotti Awaiting requested review from ezio-melotti ezio-melotti will be requested when the pull request is marked ready for review ezio-melotti is a code owner
@hugovk hugovk Awaiting requested review from hugovk hugovk will be requested when the pull request is marked ready for review hugovk is a code owner
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner will be requested when the pull request is marked ready for review AA-Turner is a code owner
@webknjaz webknjaz Awaiting requested review from webknjaz webknjaz will be requested when the pull request is marked ready for review webknjaz is a code owner
@itamaro itamaro Awaiting requested review from itamaro itamaro will be requested when the pull request is marked ready for review itamaro is a code owner
@JacobCoffee JacobCoffee Awaiting requested review from JacobCoffee JacobCoffee will be requested when the pull request is marked ready for review JacobCoffee is a code owner
@StanFromIreland StanFromIreland Awaiting requested review from StanFromIreland StanFromIreland will be requested when the pull request is marked ready for review StanFromIreland is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@vstinner
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.