[issue34270] Add names to asyncio tasks
Yury Selivanov
report at bugs.python.org
Thu Aug 9 10:55:28 EDT 2018
Yury Selivanov <yselivanov at gmail.com> added the comment:
> I also couldn't figure out yet why PyUnicode_Check() was necessary in the first place. Doesn't PyObject_Str() just increment the refcount if the argument is already a string?
`str()` returns its argument if it's exactly a `builtins.str` instance. If it's a subclass of str, it will construct a `builtins.str` out of it.
>>> class mystr(str):
... pass
>>> a = mystr('aaa')
>>> str(a) is a
False
So Eric is right, there's a small discrepancy between Python and C version.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34270>
_______________________________________
More information about the Python-bugs-list
mailing list