Message282377
| Author |
vstinner |
| Recipients |
python-dev, serhiy.storchaka, vstinner |
| Date |
2016年12月04日.23:11:18 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1480893079.06.0.747517062557.issue28858@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
When I wrote the _PyObject_CallArg1(), it looks as a cool hack:
#define _PyObject_CallArg1(func, arg) \
_PyObject_FastCall((func), (PyObject **)&(arg), 1)
It hacks the declaration of an explicit "stack" like:
PyObject *stack[1];
stack[0] = arg;
res = _PyObject_FastCall(func, stack, 1);
And I expected that the C compiler magically computes the memory address of the argument. But it seems like requesting the memory address of an argument allocates something on the C stack.
On x86_64, first function arguments are passed with CPU registers. Maybe requesting the memory address of an argument requires to allocate a local variable, copy the register into the variable, to get the address of the local variable?
So, I suggest to *remove* the _PyObject_CallArg1() macro, and use existing functions like PyObject_CallFunctionObjArgs().
What do you think Serhiy? |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2016年12月04日 23:11:19 | vstinner | set | recipients:
+ vstinner, python-dev, serhiy.storchaka |
| 2016年12月04日 23:11:19 | vstinner | set | messageid: <1480893079.06.0.747517062557.issue28858@psf.upfronthosting.co.za> |
| 2016年12月04日 23:11:19 | vstinner | link | issue28858 messages |
| 2016年12月04日 23:11:18 | vstinner | create |
|