[New-bugs-announce] [issue30197] Enhance swap_attr() and swap_item() in test.support

Serhiy Storchaka report at bugs.python.org
Fri Apr 28 07:06:00 EDT 2017


New submission from Serhiy Storchaka:

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.

----------
components: Tests
messages: 292527
nosy: ezio.melotti, michael.foord, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Enhance swap_attr() and swap_item() in test.support
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30197>
_______________________________________


More information about the New-bugs-announce mailing list