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
Fix usage of Py_ssize_t type in Python/compile.c #63816
Comments
On Windows 64-bit, Visual Studio generates a lot of warnings because Py_ssize_t values are downcasted to int. Attached patch fixes all warnings and move the final downcast into compiler_addop_i(). This function uses an assertion to check that integer parameter fits into an C int type. I don't know if it's safe to "return 0" on overflow error. The patch fixes also some indentation issues seen was I wrote the patch. Nobody complained before, I don't know if the bugs can be seen in practice, so I prefer to not touch Python 2.7 nor 3.2. |
You could use the Py_SAFE_DOWNCAST macro everywhere. |
I prefer to store sizes in a size type (Py_ssize_t), and only downcast where it is really needed, in compiler_addop_i(). So in the future, if someone wants to support values larger than INT_MAX, only one function need to be changed. |
I meant where you added casts, you could use it. 2013/11/18 STINNER Victor <report@bugs.python.org>:
|
Oops, I forgot to mention this issue number in the commit: The bytecode doesn't support integer parameters larger than 32-bit yet. I added some more Py_SAFE_DOWNCAST() in the final commit. |
New changeset 8d3e85dfa46f by Victor Stinner in branch 'default': |
New changeset ee4da7291211 by Victor Stinner in branch 'default': |
New changeset 116bd550e309 by Victor Stinner in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: