[issue3781] warnings.catch_warnings fails gracelessly when recording warnings but no warnings are emitted

Jean-Paul Calderone report at bugs.python.org
Tue Sep 9 16:37:58 CEST 2008


Jean-Paul Calderone <exarkun at divmod.com> added the comment:

Exposing a list seems like a great low-level API to me.  There are no
[-1]s in the Twisted codebase as a result of using this API because we
have a higher-level API built on top of it.  Having this low-level API
that doesn't try to make a specific application more convenient (at the
cost of ambiguity) means anyone can write a better high-level API on top
of it that makes a specific use-case convenient.

For Twisted, we actually would have very little difficulty coming up
with our own version of catch_warnings without copying the
implementation from the test_support module.  What we are *really*
interested in is a public API.  Copying the implementation from
test_support doesn't give us that.

I understand the concern with introducing changes like this into CPython
so close to a release.  I just want it to be clear that without a public
API for this feature, the issue isn't resolved for Twisted. That may not
have been clear by just looking at this ticket, but see also issue3780
which I filed before filing this one which was also marked as a release
blocker and which was resolved only because of the existence of
`warnings.catch_warnings` (therefore removing the public API would mean
re-opening that ticket).

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


More information about the Python-bugs-list mailing list