classification
Title: Enhance swap_attr() and swap_item() in test.support
Type: enhancement Stage: resolved
Components: Tests Versions: Python 3.7, Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, michael.foord, serhiy.storchaka, vstinner
Priority: normal Keywords:

Created on 2017-04-28 11:06 by serhiy.storchaka, last changed 2017-04-28 17:07 by serhiy.storchaka. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1341 merged serhiy.storchaka, 2017-04-28 11:09
PR 1345 merged serhiy.storchaka, 2017-04-28 16:31
PR 1346 merged serhiy.storchaka, 2017-04-28 16:35
PR 1347 merged serhiy.storchaka, 2017-04-28 16:46
Messages (5)
msg292527 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-04-28 11:06
Proposed patch adds two features to functions swap_attr() and swap_item() in the test.support module.

1. They now work (rather than failing in __exit__) when delete the attribute or item inside the with block. There were several cases when I refused to use these functions instead of manually coded try/finally due to lack of this feature.

2. The original value of the attribute or item can be assigned to the target of "as" in the with statement. This can save a line of the code in some cases.
msg292536 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-04-28 16:17
New changeset d1a1def7bf221b04dcf3fc3a67aa19aa2f622f83 by Victor Stinner (Serhiy Storchaka) in branch 'master':
bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. (#1341)
https://github.com/python/cpython/commit/d1a1def7bf221b04dcf3fc3a67aa19aa2f622f83
msg292539 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-04-28 17:05
New changeset 712114b3f9f5f98f03c66a80607b6f7101c5cc90 by Serhiy Storchaka in branch '3.6':
[3.6] bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. (GH-1341) (#1345)
https://github.com/python/cpython/commit/712114b3f9f5f98f03c66a80607b6f7101c5cc90
msg292541 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-04-28 17:05
New changeset 910ba937e90ffe3aa154a5b27dc7e2c3d3c88d1f by Serhiy Storchaka in branch '3.5':
[3.5] bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. (#1341) (#1346)
https://github.com/python/cpython/commit/910ba937e90ffe3aa154a5b27dc7e2c3d3c88d1f
msg292542 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-04-28 17:06
New changeset 941ea53b5776aaeb9dc1026e482a4ce5c5768830 by Serhiy Storchaka in branch '2.7':
[2.7] bpo-30197: Enhance swap_attr() and backport swap_item() in test.test_support. (#1341) (#1347)
https://github.com/python/cpython/commit/941ea53b5776aaeb9dc1026e482a4ce5c5768830
History
Date User Action Args
2017-04-28 17:07:22serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-04-28 17:06:32serhiy.storchakasetmessages: + msg292542
2017-04-28 17:05:55serhiy.storchakasetmessages: + msg292541
2017-04-28 17:05:07serhiy.storchakasetmessages: + msg292539
2017-04-28 16:46:21serhiy.storchakasetpull_requests: + pull_request1459
2017-04-28 16:35:02serhiy.storchakasetpull_requests: + pull_request1458
2017-04-28 16:31:04serhiy.storchakasetpull_requests: + pull_request1457
2017-04-28 16:17:28vstinnersetnosy: + vstinner
messages: + msg292536
2017-04-28 11:09:58serhiy.storchakasetpull_requests: + pull_request1452
2017-04-28 11:06:00serhiy.storchakacreate