Message72838
Reopening this because I disagree with the fix - I would prefer to see
catch_warnings() reverted back to the API and implementation* it used
prior to the test_support->warnings migration.
That version had perfectly clear semantics when no warning was issued:
w.message (and all of the other warning attributes) were None. If the
implementation of WarningsRecorder hadn't been changed then this bug
would have never arisen.
The attributes of the last warning are cached on the recorder because by
*far* the most common intended use case that makes use of the warnings
recorder is to test operations that are expected to raise a single
warning. The list of warnings is retained solely for special cases where
one operation raises multiple warnings (e.g. see the py3k warnings tests
for __hash__ inheritance).
*aside from the use of @contextmanager, obviously |
|
Date |
User |
Action |
Args |
2008-09-09 10:38:10 | ncoghlan | set | recipients:
+ ncoghlan, barry, brett.cannon, exarkun, pitrou, benjamin.peterson |
2008-09-09 10:38:10 | ncoghlan | set | messageid: <1220956690.22.0.626835845341.issue3781@psf.upfronthosting.co.za> |
2008-09-09 10:38:04 | ncoghlan | link | issue3781 messages |
2008-09-09 10:38:02 | ncoghlan | create | |
|