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.

Author serhiy.storchaka
Recipients mark.dickinson, serhiy.storchaka
Date 2012-10-18.15:24:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <201210181823.50764.storchaka@gmail.com>
In-reply-to <1350572193.35.0.503899791259.issue16277@psf.upfronthosting.co.za>
Content
> Okay, but do you agree that (1) there's no undefined behaviour, and (2)
> removing this code has the potential to change results on platforms where
> converting NULL to an integer doesn't give zero?

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.

> > I believe Python does not support platforms where it matters.
> What's your justification for this belief?

Can you show the contrexample? I can not. If such a platform existed, perhaps 
this bug has been already shown it.

> Sorry, but this is making no sense to me.  You wrote: "(Py_uintptr_t)p -
> (Py_uintptr_t)(void *)NULL".  Is that supposed to be existing code that
> you're proposing changing?  An example to prove some point (what point?) 
> Code you're proposing to add somewhere?  (If so, where are you proposing
> to add it?)  Why are you subtracting these two pointers?  What's p?  I'm
> finding it hard to make sense of what you're writing.

I mean using PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)
((Py_uintptr_t)p - (Py_uintptr_t)(void *)NULL)) instead 
PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)(Py_uintptr_t)p). Of course 
PyLong_AsVoidPtr() should be changed to return (void *)(x + (Py_uintptr_t)
(void *)NULL) instead (void *)x.
History
Date User Action Args
2012-10-18 15:24:09serhiy.storchakasetrecipients: + serhiy.storchaka, mark.dickinson
2012-10-18 15:24:09serhiy.storchakalinkissue16277 messages
2012-10-18 15:24:09serhiy.storchakacreate