homepage

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 vstinner
Recipients Devin Jeanpierre, vstinner
Date 2013年04月29日.22:00:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1367272807.19.0.017827588523.issue17870@psf.upfronthosting.co.za>
In-reply-to
Content
"PyLong_FromVoidPtr works for uintptr_t, but not intptr_t."
Ok correct. You should use something like:
PyObject*
PyLong_FromIntptr_t(intptr_t value)
{
 if (sizeof(intptr_t) == sizeof(long))
 return PyLong_FromLong(value);
 else {
 assert(sizeof(intptr_t) <= sizeof(PY_LONG_LONG));
 return PyLong_FromLongLong((PY_LONG_LONG)value);
 }
}
The "if (sizeof(intptr_t) == sizeof(long))" should be optimized by your compiler.
I don't know if Python should provide such function. What is your use case for intptr_t?
It looks like intptr_t is only really used in the implementation of os.spawnv() and os.spawnve(). Extract:
#if SIZEOF_LONG == SIZEOF_VOID_P
 return Py_BuildValue("l", (long) spawnval);
#else
 return Py_BuildValue("L", (PY_LONG_LONG) spawnval);
#endif
History
Date User Action Args
2013年04月29日 22:00:07vstinnersetrecipients: + vstinner, Devin Jeanpierre
2013年04月29日 22:00:07vstinnersetmessageid: <1367272807.19.0.017827588523.issue17870@psf.upfronthosting.co.za>
2013年04月29日 22:00:07vstinnerlinkissue17870 messages
2013年04月29日 22:00:06vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /