Author vstinner
Recipients gvanrossum, vstinner, yselivanov
Date 2016-12-09.13:38:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1481290693.49.0.157975678284.issue28920@psf.upfronthosting.co.za>
In-reply-to
Content
The new _asyncio module of Python 3.6 uses the _PyObject_CallMethodId() function to call functions. This function has a weird behaviour when using the format string "O": if the object is a tuple, the tuple is unpacked.

_PyObject_CallMethodId(obj, &PyId_meth, "O", tuple, NULL) calls obj.meth(*tuple) instead of obj.meth(tuple).

I only found one function which may have the bug: task_call_step(). But it seems like this function cannot be called with a tuple as "arg", only with an exception object.

But just in case, I would suggest to replace:
   _PyObject_CallMethodId(obj, nameid, "O", arg);
with
   _PyObject_CallMethodIdObjArgs(obj, nameid, arg, NULL);

Note: _PyObject_CallMethodId() is called with a NULL terminal in the argument list, but the NULL is useless. A terminator is only required by _PyObject_CallMethodIdObjArgs(). Yeah, Python has a wide choice of functions to call a callable object, with funny APIs... And I'm adding new ones to Python 3.7 ;-)
History
Date User Action Args
2016-12-09 13:38:13vstinnersetrecipients: + vstinner, gvanrossum, yselivanov
2016-12-09 13:38:13vstinnersetmessageid: <1481290693.49.0.157975678284.issue28920@psf.upfronthosting.co.za>
2016-12-09 13:38:13vstinnerlinkissue28920 messages
2016-12-09 13:38:12vstinnercreate