Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

> 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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45325>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to