Uh oh!
There was an error while loading. Please reload this page.
gh-111178: fix UBSan failures in Modules/_interp*module.c - #129779
Conversation
picnixz
commented
Feb 7, 2025
Ah I'm sorry I put this one as ready for review but I learned that _ + capital letter was also UB (#128248 (comment)) so I'll fix them tomorrow. |
ZeroIntensity
commented
Feb 7, 2025
It's not exactly UB, it's just that those names are reserved for the C standard. In practice, it's probably fine to leave it, and not worth the inconsistency/confusion of adding a |
picnixz
commented
Feb 7, 2025
The problem with |
ZeroIntensity
commented
Feb 8, 2025
Half the codebase is UB then! I understand the issue, but what's the actual chance that we'll get broken by prefixing something with |
The chance is probably almost zero but Petr wanted to avoid adding more UBs. So I guess it makes sense. By the way, I found it easier to actually type the macro without the leading underscore as well so it's also a good idea to actually ease writing! |
encukou
commented
Feb 8, 2025
Half?
It is exactly UB. That's a hard fact. The C23 standard says:
Also yes. CPython is big enough that we can hope that compiler/libc authors won't actually use the In practice, new features in C nowadays tend to start with double-underscore or underscore+uppercase. Let's not use more of those -- especially in PRs that remove UB. (Speaking of technicalities: PEP-7 says “ |
picnixz
commented
Feb 8, 2025
Concerning the |
ZeroIntensity
commented
Feb 8, 2025
Not disagreeing, I'm just saying it's not UB in the same way that using uninitialized memory is UB. I'm just pointing out that messing around with it probably isn't worth the weird inconsistencies in our macros. There's no actual plan to remove |
Uh oh!
There was an error while loading. Please reload this page.
This PR fixes the UBSan failures and addresses some minor cosmetic changes. PEP-7 changes were not applied since they could scramble the diff but other semantic changes affecting the signature of touched functions may have been done.