Author brett.cannon
Recipients brett.cannon, nnorwitz
Date 2007-10-09.19:53:17
SpamBayes Score 0.00587996
Marked as misclassified No
Message-id <1191959598.03.0.105570448043.issue1631171@psf.upfronthosting.co.za>
In-reply-to
Content
I figured out why the tests are all failing; the C code does not call
back into the Python 'warnings' wrapper.

For instance, warn_explicit in the C code does not ever try to use a
user-provided showwarning() function.  This causes the tests to fail as
they rely on this functionality.

There is also the issue of the filters and once_registry also only be
referenced in the C code and not in the Python code.  So while the list
and dict, respectively, are assigned in warnings.py from _warnings.c,
the C code never checks to see if the attributes in the Python code were
changed.  This is an issue as a lot of times code does::

  warnings.filter = []
  ... code ...
  warnings.filter = original_filter

That will not work with how it is implemented now as the C code only
works off of the object it created and never one that a user may have
provided.

Could a descriptor be written so that when the Python code has the
filter, once_registry, or showwarnings set it actually gets set in the C
code?  That way the C code can continue to be fully independent of the
Python code and not have to import it unless a specific change was
attempted upon 'warnings'?
History
Date User Action Args
2007-10-09 19:53:18brett.cannonsetspambayes_score: 0.00587996 -> 0.00587996
recipients: + brett.cannon, nnorwitz
2007-10-09 19:53:18brett.cannonsetspambayes_score: 0.00587996 -> 0.00587996
messageid: <1191959598.03.0.105570448043.issue1631171@psf.upfronthosting.co.za>
2007-10-09 19:53:18brett.cannonlinkissue1631171 messages
2007-10-09 19:53:17brett.cannoncreate