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 eric.snow
Recipients alex.gronholm, asvetlov, eric.snow, yselivanov
Date 2018-08-09.14:41:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1533825684.86.0.56676864532.issue34270@psf.upfronthosting.co.za>
In-reply-to
Content
FWIW, the C implementation of Task.__init__ is not exactly equivalent to the Python implementation (nor to both the C and Python implementation of Task.set_name).  In the C impl of Task.__init__ the provided name is used as-is if it's an instance of str:

   (_asyncio_Task___init___impl() in Modules/_asynciomodule.c)

   if (name == Py_None) {
       name = PyUnicode_FromFormat("Task-%" PRIu64, ++task_name_counter);
   } else if (!PyUnicode_Check(name)) {
       name = PyObject_Str(name);
   } else {
       Py_INCREF(name);
   }

One of the following should happen, right?

1. fix the Python implementation of Task.__init__() and both impl of Task.set_name()
2. change the check to PyUnicode_CheckExact()
3. remove the special-case (i.e. change the C impl to match the Python impl)

p.s. Sorry I did not notice this before it got committed. :/
History
Date User Action Args
2018-08-09 14:41:24eric.snowsetrecipients: + eric.snow, asvetlov, alex.gronholm, yselivanov
2018-08-09 14:41:24eric.snowsetmessageid: <1533825684.86.0.56676864532.issue34270@psf.upfronthosting.co.za>
2018-08-09 14:41:24eric.snowlinkissue34270 messages
2018-08-09 14:41:24eric.snowcreate