Message323324
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. :/ | |
| Date | User | Action | Args | | 2018-08-09 14:41:24 | eric.snow | set | recipients: + eric.snow, asvetlov, alex.gronholm, yselivanov | | 2018-08-09 14:41:24 | eric.snow | set | messageid: <1533825684.86.0.56676864532.issue34270@psf.upfronthosting.co.za> | | 2018-08-09 14:41:24 | eric.snow | link | issue34270 messages | | 2018-08-09 14:41:24 | eric.snow | create | | |