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 pablogsal, serhiy.storchaka, vstinner
Date 2021-09-29.21:46:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1632951990.09.0.0351680563867.issue45325@roundup.psfhosted.org>
In-reply-to
Content
> What happens if you pass a double, it is stored as a double on the C stack, and then Py_BuildValue() will read junk data?

AFAIK, it is complicated. On old computer primitive compilers just pushed arguments one by one on the stack (in platform-depending order). When you push 64-bytes double and read 32-bit int, you get a junk not only for this read, but for reads of all following or preceding arguments.

Modern compilers on modern platforms can use registers to pass variable arguments. I do not know details, but doubles and ints are passed using different registers, so the difference can be even larger.

My concern is that such feature can provoke bugs. The risk can exceed the minor benefit.
History
Date User Action Args
2021-09-29 21:46:30serhiy.storchakasetrecipients: + serhiy.storchaka, vstinner, pablogsal
2021-09-29 21:46:30serhiy.storchakasetmessageid: <1632951990.09.0.0351680563867.issue45325@roundup.psfhosted.org>
2021-09-29 21:46:30serhiy.storchakalinkissue45325 messages
2021-09-29 21:46:30serhiy.storchakacreate