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.13:51:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <201210181651.20215.storchaka@gmail.com>
In-reply-to <1350564991.53.0.447049972916.issue16277@psf.upfronthosting.co.za>
Content
> For the second part, I don't see any undefined behaviour here.  Can you
> explain where the undefined behaviour comes from?  And are you sure that
> this is really just an optimization?  It looks as though it might be
> deliberately there to make sure that the conversion still produces a
> Python 0 even on systems where the NULL pointer *doesn't* give 0 when
> converted to an integer.

If on some platform (uintptr_t)NULL != 0, then some other address can be 
reflected to 0. In shuch case PyLong_FromVoidPtr() returns zero integer for 
both NULL and this non-NULL addresses. Of course this is a hypothetic 
situation.

What about (Py_uintptr_t)p - (Py_uintptr_t)(void *)NULL? Then we should change 
PyLong_AsVoidPtr() too.
History
Date User Action Args
2012-10-18 13:51:37serhiy.storchakasetrecipients: + serhiy.storchaka, mark.dickinson
2012-10-18 13:51:37serhiy.storchakalinkissue16277 messages
2012-10-18 13:51:37serhiy.storchakacreate