-
-
Notifications
You must be signed in to change notification settings - Fork 32k
Type of vectorcall nargs inconsistent #134457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
cc @picnixz for UBSan |
Another problematic location is methodobject.c:466 where That is because methodobject.h defines the callbacks with nargs as This is an example of the sanitizer output:
Switching nargs back to signed in my code makes that go away, but CPython being so inconsistent is what needs to be fized. |
Don't know how consistent it's been kept over the years, but the intended convention for types and names was:
In particular, That seems to be your case: if Do you have an example where the convention isn't followed? |
@encukou you are correct, and there are no CPython problems. That vector and fast calls have the same signatures, except for the signedness of nargs turned out to be a benefit. I've been converting over 300 C method callbacks so that the first parameter is a |
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
The documentation is clear that it is
size_t
However if you search the Python source for
nargs
, it is oftenPy_ssize_t
One is signed and the other is unsigned. It looks like argument clinic is one culprit.
Ordinarily this is no big deal, because it would take too many arguments to overflow. However the clang undefined behaviour sanitizer gets upset when the sign on that parameter is wrong. See #111178 for why that matters.
I discovered this because I had copied argument clinic using
Py_ssize_t
and then hit ubsan issues.CPython versions tested on:
3.14
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered: