[issue34270] Add names to asyncio tasks

2018-08-13 Thread Benjamin Peterson
Benjamin Peterson added the comment: New changeset aa4e4a40db531f7095513a4b0aa6510f18162a07 by Benjamin Peterson in branch 'master': Make regular expressions in test_tasks.py raw strings. (GH-8759) https://github.com/python/cpython/commit/aa4e4a40db531f7095513a4b0aa6510f18162a07 --

[issue34270] Add names to asyncio tasks

2018-08-13 Thread Benjamin Peterson
Change by Benjamin Peterson : -- pull_requests: +8235 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Yury Selivanov
Change by Yury Selivanov : -- resolution: -> fixed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Alex Grönholm
Change by Alex Grönholm : -- pull_requests: +8202 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Alex Grönholm
Alex Grönholm added the comment: > I'll do that if you say so, but I'm just saying that the C and Python implementations will still remain different in semantics then. Never mind, that was a brain fart. I keep ignoring the "!" in my mind. -- ___

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Yury Selivanov
Yury Selivanov added the comment: > I'll do that if you say so, but I'm just saying that the C and Python > implementations will still remain different in semantics then. Probably I'm missing something here. How would they be different? -- ___

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Yury Selivanov
Yury Selivanov added the comment: Please just change PyUnicode_Check to PyUnicode_CheckExact in C Task.__init__ and use the same if check in C Task.set_name. -- ___ Python tracker

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Alex Grönholm
Alex Grönholm added the comment: > Please just change PyUnicode_Check to PyUnicode_CheckExact in C Task.__init__ > and use the same if check in C Task.set_name. I'll do that if you say so, but I'm just saying that the C and Python implementations will still remain different in semantics

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Alex Grönholm
Alex Grönholm added the comment: > On the other had, the matter is made moot by using PyUnicode_CheckExact() Then, in order to keep the pure Python implementation in sync, we'd have to change it to something like this: if name is None: self._name = f'Task-{_task_name_counter()}' elif

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Eric Snow
Eric Snow added the comment: I'm not too invested in any changes happening at this point, actually. :) Mostly I happened to be reading through the commit and noticed the inconsistency. If I had reviewed the PR then I would have asked that it be fixed. So I figured I'd mention it. FWIW,

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Alex Grönholm
Alex Grönholm added the comment: Which way do we want to change this? Do we want to convert to pure strings or retain the original object? In the latter case both the C and Python implementations (including set_name()) have to be changed. -- ___

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Yury Selivanov
Yury Selivanov added the comment: Let's just reuse this issue, it's just a small fix. -- resolution: fixed -> ___ Python tracker ___

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Alex Grönholm
Alex Grönholm added the comment: > It's not a bad thing, it's just that we don't do it in C Task and we do it in > pure Python Task. Eric wants us to synchronize them so that in a very > unlikely scenario where someone uses subclasses of str for names they will > have exact same behaviour

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Yury Selivanov
Yury Selivanov added the comment: > Ok, I understand. But is the conversion a bad thing then? It's not a bad thing, it's just that we don't do it in C Task and we do it in pure Python Task. Eric wants us to synchronize them so that in a very unlikely scenario where someone uses subclasses

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Alex Grönholm
Alex Grönholm added the comment: Ok, I understand. But is the conversion a bad thing then? -- ___ Python tracker ___ ___

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Yury Selivanov
Yury Selivanov 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

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Alex Grönholm
Alex Grönholm added the comment: Yury, I have no objections. Furthermore, it would be nice to expose the coroutine object publicly, like curio and trio do. It would make life simpler for me in some cases. -- ___ Python tracker

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Alex Grönholm
Alex Grönholm 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? Eric, please explain why these changes should be done. --

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Yury Selivanov
Yury Selivanov added the comment: As a side note, Alex, what do you think about appending coroutine's name to Task's name if the latter is autogenerated? -- ___ Python tracker

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Yury Selivanov
Yury Selivanov added the comment: > 2. change the check to PyUnicode_CheckExact() I'd be OK with this, but why is this important? -- ___ Python tracker ___

[issue34270] Add names to asyncio tasks

2018-08-09 Thread Eric Snow
Eric Snow 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:

[issue34270] Add names to asyncio tasks

2018-08-08 Thread Yury Selivanov
Yury Selivanov added the comment: Thank you for the contribution! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue34270] Add names to asyncio tasks

2018-08-08 Thread Yury Selivanov
Yury Selivanov added the comment: New changeset cca4eec3c0a67cbfeaf09182ea6c097a94891ff6 by Yury Selivanov (Alex Grönholm) in branch 'master': bpo-34270: Make it possible to name asyncio tasks (GH-8547) https://github.com/python/cpython/commit/cca4eec3c0a67cbfeaf09182ea6c097a94891ff6

[issue34270] Add names to asyncio tasks

2018-07-29 Thread Roundup Robot
Change by Roundup Robot : -- keywords: +patch pull_requests: +8063 stage: -> patch review ___ Python tracker ___ ___

[issue34270] Add names to asyncio tasks

2018-07-29 Thread Alex Grönholm
New submission from Alex Grönholm : Having names on tasks helps tremendously when something goes wrong in a complex asyncio application. Threads have names and even trio has the ability to name its tasks. This would also greatly benefit PyCharm's concurrency visualization: