This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lekma
Recipients lekma
Date 2010-10-31.18:53:33
SpamBayes Score 0.0013866137
Marked as misclassified No
Message-id <1288551215.82.0.402250167562.issue10271@psf.upfronthosting.co.za>
In-reply-to
Content
Overriding warnings.showwarning() with a c/python module function (from a c/python module) doesn't work because warn_explicit() only allow PyFunction or PyMethod objects to be called (unfortunately c/python module functions are of type PyCFunction).

Suggested changes in _warnings.c (from py3k) - not tested at all:

from:
412            if (!PyMethod_Check(show_fxn) && !PyFunction_Check(show_fxn)) {
413                PyErr_SetString(PyExc_TypeError,
414                                "warnings.showwarning() must be set to a "
415                                "function or method");

to:
412            if (!PyCallable_Check(show_fxn)) {
413                PyErr_SetString(PyExc_TypeError,
414                                "warnings.showwarning() must be set to a "
415                                "callable");
History
Date User Action Args
2010-10-31 18:53:35lekmasetrecipients: + lekma
2010-10-31 18:53:35lekmasetmessageid: <1288551215.82.0.402250167562.issue10271@psf.upfronthosting.co.za>
2010-10-31 18:53:34lekmalinkissue10271 messages
2010-10-31 18:53:33lekmacreate