classification
Title: PyLong_AsSize_t returns (unsigned long)-1
Type: behavior Stage: patch review
Components: Interpreter Core Versions: Python 3.1, Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: mark.dickinson, python-dev, skrah, vstinner
Priority: normal Keywords: patch

Created on 2011-09-12 12:13 by skrah, last changed 2011-09-12 19:12 by skrah. This issue is now closed.

Files
File name Uploaded Description Edit
pylong_as_size_t.diff skrah, 2011-09-12 12:13 review
Messages (5)
msg143896 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2011-09-12 12:13
In one of the error branches PyLong_AsSize_t() returns (unsigned long)-1
instead of (size_t)-1.
msg143900 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2011-09-12 12:35
Yep, clearly a bug.  Please fix!
msg143901 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-09-12 12:36
I suppose that you can test if the bug is tested on Windows 64 bits, where sizeof(long)=32 bits, whereas sizeof(size_t) is 64 bits.
msg143903 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-09-12 14:27
New changeset d14f717b5e3d by Stefan Krah in branch '3.2':
Issue #12963: PyLong_AsSize_t() now returns (size_t)-1 in all error cases.
http://hg.python.org/cpython/rev/d14f717b5e3d

New changeset c91900e4e805 by Stefan Krah in branch 'default':
Merge fix for issue #12963.
http://hg.python.org/cpython/rev/c91900e4e805
msg143927 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2011-09-12 19:12
> Yep, clearly a bug.  Please fix!

Done, thanks for reviewing.


Victor, I don't think we need a unit test for this. I plan to go
over some modules with gcov in the future, and I'll include
longobject.c.
History
Date User Action Args
2011-09-12 19:12:59skrahsetstatus: open -> closed
resolution: fixed
messages: + msg143927
2011-09-12 14:27:48python-devsetnosy: + python-dev
messages: + msg143903
2011-09-12 12:36:59vstinnersetnosy: + vstinner
messages: + msg143901
2011-09-12 12:35:55mark.dickinsonsetmessages: + msg143900
2011-09-12 12:13:46skrahcreate