Issue24336
Created on 2015-05-31 07:55 by martin.panter, last changed 2015-06-28 14:13 by serhiy.storchaka. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| context-kw.patch | martin.panter, 2015-05-31 07:55 | review | ||
| context-kw.v2.patch | martin.panter, 2015-05-31 08:23 | review | ||
| context-kw.v3.patch | martin.panter, 2015-05-31 10:55 | review | ||
| context-kw-2.7.patch | martin.panter, 2015-05-31 23:45 | Test only for 2.7 | review | |
| Messages (12) | |||
|---|---|---|---|
| msg244523 - (view) | Author: Martin Panter (martin.panter) * | Date: 2015-05-31 07:55 | |
This patch allows many context managers to accept keyword arguments called “func” and “self”. Current behaviour: >>> with TestCase().subTest(func="blaua"): pass ... Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.4/contextlib.py", line 126, in helper return _GeneratorContextManager(func, *args, **kwds) TypeError: __init__() got multiple values for argument 'func' |
|||
| msg244526 - (view) | Author: Martin Panter (martin.panter) * | Date: 2015-05-31 08:23 | |
Sorry here’s a better version that adapts some monkey-patching in the test suite (test_with). |
|||
| msg244532 - (view) | Author: Martin Panter (martin.panter) * | Date: 2015-05-31 10:55 | |
New version with simpler test; thanks Serhiy. Looking closer at the history, this actually seems to be a regression caused by revision e4ba097123f6 (Issue 11647). Python 2 is not affected. |
|||
| msg244533 - (view) | Author: Martin Panter (martin.panter) * | Date: 2015-05-31 11:00 | |
But maybe it wouldn’t hurt adding the test case in test_contextlib to Python 2. |
|||
| msg244539 - (view) | Author: Nick Coghlan (ncoghlan) * | Date: 2015-05-31 14:26 | |
The v3 patch looks good to me, and indeed it's a regression I introduced back in 3.2. I don't see much value in adding the test to the 2.7 test suite (with contextlib2 just a pip install away, it's very unlikely the standard library version will see any significant updates) |
|||
| msg244541 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2015-05-31 14:38 | |
LGTM. The patch isn't applied cleanly to 2.7. If you Martin will provide the patch with tests for 2.7, I don't see why not apply it. |
|||
| msg244566 - (view) | Author: Martin Panter (martin.panter) * | Date: 2015-05-31 23:45 | |
Here is a patch with just the test case for 2.7, although I don’t have a strong opinion on whether it needs to be added or not. |
|||
| msg245858 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2015-06-26 17:53 | |
Ping. |
|||
| msg245886 - (view) | Author: Yury Selivanov (yselivanov) * | Date: 2015-06-27 17:49 | |
lgtm.. Serhiy, I think you should just commit it. |
|||
| msg245895 - (view) | Author: Nick Coghlan (ncoghlan) * | Date: 2015-06-28 03:02 | |
My apologies Serhiy, I forgot this was directly assigned to me - all yours now! |
|||
| msg245904 - (view) | Author: Roundup Robot (python-dev) | Date: 2015-06-28 14:12 | |
New changeset f0053d05ed6d by Serhiy Storchaka in branch '3.4': Issue #24336: The contextmanager decorator now works with functions with https://hg.python.org/cpython/rev/f0053d05ed6d New changeset 20aa7083057e by Serhiy Storchaka in branch '3.5': Issue #24336: The contextmanager decorator now works with functions with https://hg.python.org/cpython/rev/20aa7083057e New changeset d4e4bfabc21f by Serhiy Storchaka in branch 'default': Issue #24336: The contextmanager decorator now works with functions with https://hg.python.org/cpython/rev/d4e4bfabc21f New changeset 85c78d4db242 by Serhiy Storchaka in branch '2.7': Issue #24336: Backported test for contextmanager. Patch by Martin Panter. https://hg.python.org/cpython/rev/85c78d4db242 |
|||
| msg245905 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2015-06-28 14:13 | |
Thank you Martin for your patch. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2015-06-28 14:13:49 | serhiy.storchaka | set | status: open -> closed resolution: fixed messages: + msg245905 stage: commit review -> resolved |
| 2015-06-28 14:12:26 | python-dev | set | nosy:
+ python-dev messages: + msg245904 |
| 2015-06-28 03:02:27 | ncoghlan | set | assignee: ncoghlan -> serhiy.storchaka messages: + msg245895 |
| 2015-06-27 17:49:01 | yselivanov | set | messages: + msg245886 |
| 2015-06-27 11:30:43 | ncoghlan | set | nosy:
+ yselivanov |
| 2015-06-26 17:53:14 | serhiy.storchaka | set | messages: + msg245858 |
| 2015-06-01 18:09:08 | Arfrever | set | nosy:
+ Arfrever |
| 2015-05-31 23:45:21 | martin.panter | set | files:
+ context-kw-2.7.patch messages: + msg244566 |
| 2015-05-31 14:38:59 | serhiy.storchaka | set | messages: + msg244541 |
| 2015-05-31 14:26:53 | ncoghlan | set | messages:
+ msg244539 stage: patch review -> commit review |
| 2015-05-31 11:00:01 | martin.panter | set | messages:
+ msg244533 versions: + Python 2.7 |
| 2015-05-31 10:55:52 | martin.panter | set | files:
+ context-kw.v3.patch messages: + msg244532 |
| 2015-05-31 09:12:52 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka components: + Library (Lib) |
| 2015-05-31 08:30:15 | rhettinger | set | assignee: ncoghlan nosy: + ncoghlan |
| 2015-05-31 08:23:11 | martin.panter | set | files:
+ context-kw.v2.patch messages: + msg244526 |
| 2015-05-31 08:05:22 | ethan.furman | set | nosy:
+ ethan.furman |
| 2015-05-31 07:55:38 | martin.panter | create | |