Eric Snow <ericsnowcurren...@gmail.com> added the comment:

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

----------
nosy: +eric.snow

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

Reply via email to