[issue29720] potential silent truncation in PyLong_AsVoidPtr

2017-03-27 Thread STINNER Victor
STINNER Victor added the comment: I closed the issue. @Oren: Please reopen the issue with a pull request if you consider that the assertion is worth it. -- stage: -> resolved status: open -> closed ___ Python tracker

[issue29720] potential silent truncation in PyLong_AsVoidPtr

2017-03-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Ah, you are right. I don't know whether Python supports such platform after dropping support of DOS. But in any case I don't see any issue here. Oren will be not active until August, so we should make the decision about closing the issue or changing the

[issue29720] potential silent truncation in PyLong_AsVoidPtr

2017-03-27 Thread STINNER Victor
STINNER Victor added the comment: > Did you meant 64-bit Windows? ;-) On Windows 64-bit, sizeof(void*) > sizeof(long), not the opposite. -- ___ Python tracker

[issue29720] potential silent truncation in PyLong_AsVoidPtr

2017-03-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > I'm suite sure that every C function of CPython breaks if this assumption > becomes wrong :-) Such platform doesn't exist. Did you meant 64-bit Windows? ;-) -- ___ Python tracker

[issue29720] potential silent truncation in PyLong_AsVoidPtr

2017-03-27 Thread STINNER Victor
STINNER Victor added the comment: "I am not sure whether such a platform exists, but on a platform where SIZEOF_VOID_P < SIZEOF_LONG, PyLong_AsVoidPtr ..." I'm suite sure that every C function of CPython breaks if this assumption becomes wrong :-) Such platform doesn't exist. You can add the

[issue29720] potential silent truncation in PyLong_AsVoidPtr

2017-03-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I don't think there is a bug. There are several ways to get the integer representation of the pointer. PyLong_FromVoidPtr() is the most straightforward. From Python side id() uses it. printf("%p") is a way of getting string representation of the pointer,

[issue29720] potential silent truncation in PyLong_AsVoidPtr

2017-03-04 Thread Oren Milman
New submission from Oren Milman: I am not sure whether such a platform exists, but on a platform where SIZEOF_VOID_P < SIZEOF_LONG, PyLong_AsVoidPtr (which is in Objects/longobject.c) is: long x; if (PyLong_Check(vv) && _PyLong_Sign(vv) < 0) x = PyLong_AsLong(vv); else