
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2017-12-08 08:59 byasvetlov, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 4764 | merged | asvetlov,2017-12-09 09:14 | |
| Messages (5) | |||
|---|---|---|---|
| msg307839 -(view) | Author: Andrew Svetlov (asvetlov)*![]() | Date: 2017-12-08 08:59 | |
Now constructions likeawait lock # "yield from lock" can be used as welltry: ...finally: lock.release()andwith (yield from lock): ...are supported. Let's deprecate them in favor ofasync with lock: ... | |||
| msg307887 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2017-12-09 09:37 | |
This can make harder writing portable code that works in 2.7, 3.4 and 3.7.What is the benefit of the deprecation? Are there inevitable design or implementation errors in these constructions? Or getting rid of them can significantly simplify the implementation? | |||
| msg307888 -(view) | Author: Andrew Svetlov (asvetlov)*![]() | Date: 2017-12-09 09:48 | |
1. asyncio is not supported by 2.7 anyway2. with (yield from lock) is based on very non-obvious tricks: a) lock.__enter__ is forbidden and raises RuntimeError b) actually lock.__iter__ is called for lock acquiring *before* calling `with` c) the object returned from __iter__ is a context manager with __enter__/__exit__ methods3. asyncio is converted to async/await syntax byhttps://bugs.python.org/issue32193 (old `yield from` style is fully supported still).4. the deprecation was proposed by Yury Selivanov inhttps://github.com/python/cpython/pull/4753#discussion_r155658200 | |||
| msg307903 -(view) | Author: Yury Selivanov (yselivanov)*![]() | Date: 2017-12-09 16:11 | |
> This can make harder writing portable code that works in 2.7, 3.4 and 3.7.asyncio for Python 3.4 is fairly outdated. Most of the async packages today require 3.5+, as they usually use async/await syntax. I say this sort of backwards compatibility (showing a warning) isn't really a big concern. A bigger concern for us is new code using 'with await lock' pattern, hence the warning. | |||
| msg307905 -(view) | Author: Andrew Svetlov (asvetlov)*![]() | Date: 2017-12-09 18:00 | |
New changeset28d8d14013ade0657fed4673f5fa3c08eb2b1944 by Andrew Svetlov in branch 'master':bpo-32253: Deprecate with statement and bare await for asyncio locks (GH-4764)https://github.com/python/cpython/commit/28d8d14013ade0657fed4673f5fa3c08eb2b1944 | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:55 | admin | set | github: 76434 |
| 2017-12-09 18:00:28 | asvetlov | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2017-12-09 18:00:07 | asvetlov | set | messages: +msg307905 |
| 2017-12-09 16:11:38 | yselivanov | set | messages: +msg307903 |
| 2017-12-09 09:48:55 | asvetlov | set | messages: +msg307888 |
| 2017-12-09 09:37:24 | serhiy.storchaka | set | nosy: +serhiy.storchaka messages: +msg307887 |
| 2017-12-09 09:14:32 | asvetlov | set | keywords: +patch stage: patch review pull_requests: +pull_request4667 |
| 2017-12-08 09:00:55 | asvetlov | set | components: + Library (Lib) |
| 2017-12-08 08:59:40 | asvetlov | create | |