Message173286
> Undefined behavior (or may be just the wrong behavior), we obtain later, > when
> converting in PyLong_AsVoidPtr() zero integer back to pointer. On
> platforms
> where converting NULL to an integer doesn't give zero it's a bug.
So maybe the fix should be to special case zero in PyLong_AsVoidPtr, and turn 0L back into NULL there?
I think it's just too risky to change the current behaviour in 3.2 and 3.3, given the number of places that PyLong_FromVoidPtr is used. Unlike you, I don't have confidence that there are no current or future platforms that don't map NULL to 0. It might be reasonable to consider a change for 3.4.
> I mean using PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)
> ((Py_uintptr_t)p - (Py_uintptr_t)(void *)NULL)) instead ...
Okay, thanks for explaining. |
|
Date |
User |
Action |
Args |
2012-10-18 18:52:31 | mark.dickinson | set | recipients:
+ mark.dickinson, serhiy.storchaka |
2012-10-18 18:52:31 | mark.dickinson | set | messageid: <1350586351.5.0.511768200474.issue16277@psf.upfronthosting.co.za> |
2012-10-18 18:52:31 | mark.dickinson | link | issue16277 messages |
2012-10-18 18:52:31 | mark.dickinson | create | |
|