
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2018-04-12 05:24 byjdemeyer, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 6456 | merged | jdemeyer,2018-04-12 05:28 | |
| Messages (5) | |||
|---|---|---|---|
| msg315212 -(view) | Author: Jeroen Demeyer (jdemeyer)*![]() | Date: 2018-04-12 05:24 | |
In contextlib, there is code which roughly looks like def _exit_wrapper(exc_type, exc, tb): return cm_exit(cm, exc_type, exc, tb) _exit_wrapper.__self__ = cmThis creates a new function _exit_wrapper from a given function cm_exit by prepending the __self__ attribute to *args. Now this is exactly what a method does too.It would be better to use an actual method for this: it's cleaner, faster and it doesn't abuse a double-underscore attribute. The latter will actually break withPEP 575, as __self__ will become a special name instead of an arbitrary attribute. | |||
| msg315221 -(view) | Author: Alyssa Coghlan (ncoghlan)*![]() | Date: 2018-04-12 12:25 | |
Yury, could you double check the async exit stack change in the PR? I think it's fine since the bound method just passes back the underlying coroutine and the tests all still pass, but a second opinion would be good :) | |||
| msg315239 -(view) | Author: Yury Selivanov (yselivanov)*![]() | Date: 2018-04-13 03:29 | |
Yep, I think this is a good fix! | |||
| msg315243 -(view) | Author: Alyssa Coghlan (ncoghlan)*![]() | Date: 2018-04-13 12:22 | |
New changeset23ab5ee667a9b29014f6f7f01797c611f63ff743 by Nick Coghlan (jdemeyer) in branch 'master':bpo-33265: use an actual method instead of a method-like function in ExitStack (GH-6456)https://github.com/python/cpython/commit/23ab5ee667a9b29014f6f7f01797c611f63ff743 | |||
| msg315244 -(view) | Author: Alyssa Coghlan (ncoghlan)*![]() | Date: 2018-04-13 12:25 | |
Classifying this as a minor performance enhancement, since methods are much simpler objects than full Python level closures.Thanks! | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:59 | admin | set | github: 77446 |
| 2018-04-13 12:25:09 | ncoghlan | set | status: open -> closed versions: + Python 3.8 type: performance messages: +msg315244 resolution: fixed stage: patch review -> resolved |
| 2018-04-13 12:22:50 | ncoghlan | set | messages: +msg315243 |
| 2018-04-13 03:29:00 | yselivanov | set | messages: +msg315239 |
| 2018-04-12 12:25:27 | ncoghlan | set | nosy: +yselivanov messages: +msg315221 |
| 2018-04-12 06:40:24 | eric.smith | set | nosy: +ncoghlan |
| 2018-04-12 05:28:43 | jdemeyer | set | keywords: +patch stage: patch review pull_requests: +pull_request6151 |
| 2018-04-12 05:24:51 | jdemeyer | create | |