-
Notifications
You must be signed in to change notification settings - Fork 784
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
PyObject_CallOneArg()
usage triggers assert
#4093
Labels
Comments
ariebovenberg
changed the title
PyObject_CallOneArg() triggers assert
Apr 18, 2024
PyObject_CallOneArg()
usage triggers assert
9 tasks
birkenfeld
added a commit
that referenced
this issue
Apr 20, 2024
Fixes #4093 - Make PY_VECTORCALL_ARGUMENTS_OFFSET a size_t like on CPython - Change the assert in PyVectorcall_NARGS to check the recovered number, not the original value (which is > PY_SSIZE_T_MAX on purpose)
Thanks for the report! #4104 should fix this. |
birkenfeld
added a commit
that referenced
this issue
Apr 20, 2024
Fixes #4093 - Make PY_VECTORCALL_ARGUMENTS_OFFSET a size_t like on CPython - Change the assert in PyVectorcall_NARGS to check the recovered number, not the original value (which is > PY_SSIZE_T_MAX on purpose)
birkenfeld
added a commit
that referenced
this issue
Apr 21, 2024
Fixes #4093 - Make PY_VECTORCALL_ARGUMENTS_OFFSET a size_t like on CPython - Change the assert in PyVectorcall_NARGS to check the recovered number, not the original value (which is > PY_SSIZE_T_MAX on purpose)
birkenfeld
added a commit
that referenced
this issue
Apr 22, 2024
Fixes #4093 - Make PY_VECTORCALL_ARGUMENTS_OFFSET a size_t like on CPython - Remove the assert in PyVectorcall_NARGS and use checked cast
github-merge-queue bot
pushed a commit
that referenced
this issue
Apr 22, 2024
Fixes #4093 - Make PY_VECTORCALL_ARGUMENTS_OFFSET a size_t like on CPython - Remove the assert in PyVectorcall_NARGS and use checked cast
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Description
I'm getting an error using
PyObject_CallOneArg()
and I think this may be a bug. Feel free to close this issue if it isn't 👀Steps to Reproduce
a minimal-ish example:
this triggers the assert below. Indeed the
n
is set to9223372036854775809
(max i64 + 1). The function seems to usually get smaller values like0
, or3
(corresponding to the number of arguments).The large value can be traced back directly to
PyObject_CallOneArg
where
1 | PY_VECTORCALL_ARGUMENTS_OFFSET
results in this massive number. Patchinglet nargsf = 1;
gets things working—but it should obviously be derived fromPY_VECTORCALL_ARGUMENTS_OFFSET
in some way.I'm still pretty new to the C API, so it isn't obvious to me what the answer is 😬. Of course I'd be happy to submit a PR if that'd help 🙂
Backtrace
No response
Your operating system and version
MacOS 14.4.1
Your Python version (
python --version
)Python 3.12.0
Your Rust version (
rustc --version
)1.77.2
Your PyO3 version
master branch
How did you install python? Did you use a virtualenv?
I then added my code to the
string_example
example in thepyo3
repoAdditional Info
No response
The text was updated successfully, but these errors were encountered: