This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients ezio.melotti, michael.foord, serhiy.storchaka
Date 2017-04-28.11:06:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1493377560.96.0.413320673715.issue30197@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-04-28 11:06:00serhiy.storchakasetrecipients: + serhiy.storchaka, ezio.melotti, michael.foord
2017-04-28 11:06:00serhiy.storchakasetmessageid: <1493377560.96.0.413320673715.issue30197@psf.upfronthosting.co.za>
2017-04-28 11:06:00serhiy.storchakalinkissue30197 messages
2017-04-28 11:06:00serhiy.storchakacreate