This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2013年11月15日 23:08 by vstinner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| compile_ssize_t.patch | vstinner, 2013年11月15日 23:08 | |||
| Messages (8) | |||
|---|---|---|---|
| msg202976 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年11月15日 23:08 | |
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. |
|||
| msg202982 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2013年11月15日 23:59 | |
You could use the Py_SAFE_DOWNCAST macro everywhere. |
|||
| msg203263 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年11月18日 09:14 | |
> 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. |
|||
| msg203292 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2013年11月18日 13:18 | |
I meant where you added casts, you could use it. 2013年11月18日 STINNER Victor <report@bugs.python.org>: > > STINNER Victor added the comment: > >> 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. > > ---------- > > _______________________________________ > Python tracker <report@bugs.python.org> > <http://bugs.python.org/issue19617> > _______________________________________ |
|||
| msg203425 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年11月19日 21:24 | |
Oops, I forgot to mention this issue number in the commit: --- changeset: 87277:68fd86a83ece tag: tip user: Victor Stinner <victor.stinner@gmail.com> date: Tue Nov 19 22:23:20 2013 +0100 files: Python/compile.c description: Issue #9566: compile.c uses Py_ssize_t instead of int to store sizes to fix compiler warnings on Windows 64-bit. Use Py_SAFE_DOWNCAST() where the final downcast is needed. The bytecode doesn't support integer parameters larger than 32-bit yet. --- I added some more Py_SAFE_DOWNCAST() in the final commit. |
|||
| msg203427 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年11月19日 21:28 | |
New changeset 8d3e85dfa46f by Victor Stinner in branch 'default': Issue #9566, #19617: Fix compilation on Windows http://hg.python.org/cpython/rev/8d3e85dfa46f |
|||
| msg203433 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年11月19日 22:03 | |
New changeset ee4da7291211 by Victor Stinner in branch 'default': Issue #9566, #19617: New try to fix compilation on Windows http://hg.python.org/cpython/rev/ee4da7291211 |
|||
| msg203441 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年11月19日 22:56 | |
New changeset 116bd550e309 by Victor Stinner in branch 'default': Issue #9566, #19617: Fix more compiler warnings in compile.c on Windows 64-bit http://hg.python.org/cpython/rev/116bd550e309 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:53 | admin | set | github: 63816 |
| 2013年11月19日 22:56:55 | python-dev | set | messages: + msg203441 |
| 2013年11月19日 22:03:46 | python-dev | set | messages: + msg203433 |
| 2013年11月19日 21:28:14 | python-dev | set | nosy:
+ python-dev messages: + msg203427 |
| 2013年11月19日 21:24:37 | vstinner | set | status: open -> closed resolution: fixed messages: + msg203425 |
| 2013年11月18日 13:18:31 | benjamin.peterson | set | messages: + msg203292 |
| 2013年11月18日 09:14:15 | vstinner | set | messages: + msg203263 |
| 2013年11月15日 23:59:05 | benjamin.peterson | set | messages: + msg202982 |
| 2013年11月15日 23:08:07 | vstinner | create | |