Nick Coghlan <[EMAIL PROTECTED]> added the comment: It turns out the warnings.catch_warnings version has re-entrancy issues due to the fact that it can't use @contextmanager:
Python 2.6b3+ (trunk:66143M, Sep 2 2008, 20:04:43) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import warnings >>> orig_filters = warnings.filters >>> cw = warnings.catch_warnings() >>> with cw: ... warnings.filters = [] ... with cw: ... pass ... >>> warnings.filters is orig_filters False >>> warnings.filters [] >>> orig_filters [('ignore', None, <type 'exceptions.PendingDeprecationWarning'>, None, 0), ('ignore', None, <type 'exceptions.ImportWarning'>, None, 0), ('ignore', None, <type 'exceptions.BytesWarning'>, None, 0)] I propose that we just revert to the test.test_support.catch_warnings implementation that was used in the beta releases, and leave the question of whether to expose this ability somewhere other than our own regression test support module for 2.7/3.1. That version worked, and the attempt to move it at the last minute has caused nothing but trouble. So on trunk we would revert the following checkins: r66135 (relocate to warnings and change API) r66321 (change API again in attempt to fix bugs in r66135) And on the py3k branch we would revert: r66139 (merge r66135) r66322* (merge r66322) *This commit actually appears to have missed the changes to test.test_support that were in r66321 - test.support was not modified by the r66322 checkin (which strikes me as all the more reason to revert all of these changes and go back to the beta implementation) ---------- assignee: brett.cannon -> _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3781> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com